Originally posted by mekanik
here's a quick awk snippet which acts on a
Field Separator -FS set as a
pipe - "|"...this can be changed to a
:,
,,
;...the output will separate each field by a newline...
Code:
awk 'BEGIN {FS = "|"} \
{f1 = $1; f2 = $2; f3 = $3; f4 = $4; f5 = $5; f6 = $6; f7 = $7; f8 = $8} \
{print "------\n"f1"\n"f2"\n"f3"\n"f4"\n"f5"\n"f6"\n"f7"\n"f8"------\n"}' somefile.txt
Quote:
stdin:
field1|field2|field3|field4|field6|field7|field8
stdout:
------
field1
field2
field3
field4
field5
field6
field7
field8
------
endless possibilities...i would also like to note, that you don't have to set the positional parameters to names, you can just call them by their position if you want...
