Re: awk command help

From: Ed Morton (morton_at_lsupcaemnt.com)
Date: 10/27/04


Date: Wed, 27 Oct 2004 16:32:08 -0500


Vish grover wrote:
> Hi ,
>
> I wanted to write a awk/sed command to (literally)swap two paramaters
> of a functions .
> So for eg :
> func_foo(param1, param2 , param3 , param4, param5);
> should be func_foo(param1, param2, param4, param3 , param5);
>
>
> Here is my simple awk command file "mycmnd.awk":
>
> BEGIN { RS=";" ; FS ="," }
> /func_foo\(/{
> print $1 "," $2 "," $4 "," $3 "," $5 ";" }

gawk 'BEGIN{RS=ORS=";";FS=OFS=","}/func_foo\(/{t=$3;$3=$4;$4=t}1'

Regards,
        
        Ed.