I want to run all this comands over the same csv file, but I don't know how to make up an awk script to run all these commands and get a new csv file with all the modifications...
The csv file has this strcuture
a,b,c,d,
1,3,4,1
2,2,3,1
...
3,3,1,2
And I want to change all the "3" in the second field for the "w" letter, all the "2" in the second field for the "y" letter and all the 3 in the third field for the "fail" word.
To obtain this output:
a,b,c,d,
1,w,4,1
2,y,fail,1
...
3,w,1,2
The .awk file is:
#! /bin/awk -f
BEGIN { FS = "," }
#{print $1","}
{sub(/3/, "w,", $2)}1
{sub(/2/, "y,", $2)}1
{sub(/3/, "fail,", $3)}1
END{print "acabé"}
The commands in between are to replace specific numbers of the same field for specific "names" And in the console I am writing:
./name.awk oldfile.csv >newfile.csv