![]() |
how to keep Field Separator in AWK when using a sub statement
Ok so here is my little one liner:
cat somefile.txt | awk -F\| '{ sub(//,"999",$3); print }' The delimiter is a | and the results end up without anything but spaces which ruins my output. I know there is a fairly easy way to avoid this - anyone? |
Moin,
Code:
awk -F\| 'BEGIN {OFS="|"}{ sub(//,"999",$3); print }' somefile.txtP.S.: Please - no useless use of cat award parties here ;-) |
Gruetzi!
Ah - yes - thanks I thought it was something similar to setting OFS! Cheers, todd |
Oh and the reason I was using a cat was due to the data actually being piped into the statement. It was really for simplicity.
|
Moin,
Quote:
Jan |
| All times are GMT -5. The time now is 08:45 AM. |