by Ed Morton <morton@[EMAIL PROTECTED]
>
Feb 12, 2008 at 08:52 AM
On 2/12/2008 8:48 AM, Ed Morton wrote:
>
> On 2/12/2008 8:18 AM, Minalba Jordao wrote:
<snip>
>>If I need to to that, with many files? Could I do it with awk? Or will
>>I need to use some shell scripting?
>
>
> You can do it with awk:
>
> awk ' FNR==1 { outfile=FILENAME ".new" }
Forgot to re-init the variables ("a" not strictly necessary):
awk ' FNR==1 { outfile=FILENAME ".new"; a=b=0 }
> /^@[EMAIL PROTECTED]
{ print > outfile; a=!a; b=1; next }
> a || /^!/ { print > outfile; next }
> b { print $1,$2,"-"$3 > outfile}' *.dat
>
> but your OS is typically better suited for the job, especially if you
want to
> replace the original files with the modified ones.