I'm tidying up some old code (not mine!) and I've come across
Ignoring the bit about the first two records (I'm sorting that out elsewhere) and the way it only deletes spaces from the third line on I'm looking to combine all this into one awk or sed statement. If it's awk then
but I can't work out how to put a sed type statement in the braces. On the other hand, if I use sed then I can't work out how to do the grep like statements. I've been buried in the lemur book for hours and I'm getting nowhere. Any pointers please.
Ceci n'est pas une signature
Columb Healy
Code:
#Remove tabs (\t or \011) and 'squeeze' out line feeds (\n or \012)
cat $tmp/pbecsu.tmp.$$|tr "\011" " "|tr -s "\012"|grep PBEC|grep -v typopn >> $tmp/pbec.tmp.$$
rm -f $tmp/pbecsu.tmp.$$
#Put quotes around each field and remove spaces, except for first 2 records
sed -e '2,$ s/^/"/; 2,$ s/;/","/g; 2,$ s/$/"/; 3,$ s/ //g' $tmp/pbec.tmp.$$ > $FNAME
Code:
awk '/PBEC/ && ! /typopn/ { .... }' input > output
Ceci n'est pas une signature
Columb Healy