Re: assistance with awk or sed




-------
Those aren't really equivalent.
Mine:
nawk 'BEGIN{FS=","} $1 ~ /^[1-9][1-9][1-9][1-9][1-9]/ { gsub(/[\,]/,"
",$0); print $0 }' yak1 | nawk '{ print $1 " " $7 " " $8 " " $11 }'
34382 2007-11-29 07:54:00 StdAcc
34383 2007-11-29 09:15:00 CustRead
34384 2007-11-29 09:24:00 LanIF
34385 2007-11-29 09:41:00 LanIF
34386 2007-11-29 09:45:00 StdAcc
34387 2007-11-29 09:48:00 OtherRout
34388 2007-11-29 09:51:00 LanIF
34389 2007-11-29 10:21:00 LanIF

Yours:
nawk 'BEGIN{FS=","} $1 ~ /^[1-9][1-9][1-9][1-9][1-9]/ { print
$1,$7,$8,$11 }' yak1
34382 07:54:00 24 EDI transactions. This is a response to an earlier
NCR\
34383 09:15:00 144 username / password credentials stopped working:
34384 09:24:00 96 DSL link Upgraded and all relevent bandwidth
statements need amending.
34385 09:41:00 12-15-2007 Please administratively shut down interface
FastEthernet0/0. Integration of MPLS network into


Anyway, I'm embarrassed to put my script here among programmers, I am
a network engineer and know little of the programmers world so out of
my league...
Here is what I have.

#!/bin/bash
#filename yakn
#echo "###########################"
#echo "Usage: yakn [inputfile] >> [ouputfile]"
#echo "###########################"
# crzzy1
cat ~/$1 | while read line
do
if [[ "$line" == [1-9][1-9][1-9][1-9][1-9]* ]]
then
{
echo "$line" | nawk 'BEGIN{FS=","} $1 ~ /^[1-9][1-9][1-9][1-9][1-9]/
{ gsub(/[\,]/," ",$0); print $
0 }' | nawk '{ print $1 " " $7 " " $8 " " $11 }'
}
elif [[ "$line" != *Auto*Closed* && ( "$line" == [^1-9]*Picked*Up* ||
"$line" == [^1-9]*Complete*
|| "$line" == [^0-9]*Approved* ) ]]
then
{
echo "$line" | nawk '{ print "Null" " " $4 " " $5 " " $7 }'
}

fi
done

----

The output is below: (Very good for pasting into my excel template,
which then calculates the times spent on each item, and sending to my
boss)
the ones that are not "Null" where tickets that where just created.
My boss is happy, although he will surely ask for some annoying
tweaks.

Thanks Ed, you pointed out stuff like FS and gsub and how to use them.
Couldn't have done this without you).


34382 2007-11-29 07:54:00 StdAcc
Null 11-29-2007 08:18 Picked
34383 2007-11-29 09:15:00 CustRead
Null 11-29-2007 10:37 Picked
34384 2007-11-29 09:24:00 LanIF
Null 11-29-2007 10:07 Picked
Null 11-29-2007 10:07 Approved
Null 11-29-2007 15:00 Complete
34385 2007-11-29 09:41:00 LanIF
Null 11-29-2007 09:50 Picked
Null 11-29-2007 10:21 Approved
Null 11-29-2007 13:20 Complete
Null 11-30-2007 11:24 Close
34386 2007-11-29 09:45:00 StdAcc
Null 11-29-2007 09:47 Picked
Null 11-29-2007 09:48 Approved
Null 11-29-2007 10:07 Complete
34387 2007-11-29 09:48:00 OtherRout
Null 11-29-2007 09:52 Picked
Null 11-29-2007 10:03 Approved
Null 11-29-2007 10:04 Complete

--------
.



Relevant Pages

  • Re: super.clone() puzzlement
    ... boss pokes nose in, finds out that zero milestones have been ... Lady programmer quits, two other good programmers quit, boss ... Microsoft unveils competing product, grabs the entire market. ...
    (comp.lang.java.programmer)
  • Re: I finally understand why Im not allowed to use Lisp
    ... Maybe this is normal in your part of the world, but I think in much of the US and UK salary paid to programmers is not related to hours worked. ... Maybe your boss knows you're last out of the building each night, but his boss probably doesn't, and it's not showing on the balance sheet ... But if we're talking about the kind of place where production code can be written by people who don't know how to use a loop, I think it'll take a while yet before agile practices filter their way down that far. ... And when they do, their biggest wins will be in tracking and coping with externally-imposed requirements change, not whether their programmers are experienced. ...
    (comp.lang.lisp)
  • Re: Analysis of Dilbert cartoon
    ... If he does it, the boss will ... No matter what you do you cannot win, ... The company's response was that it was all my fault, I didn't know how to program (which I took as a personal insult, having finished two years of writing software for my M. Sc. ... to talk to the programmers in queston privately, say, next to a water ...
    (sci.research.careers)
  • Analysis of Dilbert cartoon
    ... Dilbert muses on the topic that the pointy-haired boss asked him ... No matter what you do you cannot win, ... I think what is happening here is that Dilbert does not demonstrate his ... to talk to the programmers in queston privately, say, next to a water ...
    (sci.research.careers)