I have a csv file looks like this:
site1.com,aaa,bbb,ccc
site2.com,qqq
site3.com,rrr,uuu,ppp
site4.com
site5.com,ddd,sss
I want to replace rows (lines) where the fourth column is empty.
and I want to manipulate said rows by running a command on them.
For example, with awk
:
awk -F, '$4=="" {system("$1,cmd1 $1")}' test.csv
I then want to export as follows (output1 is output from cmd1 command):
site1.com,aaa,bbb,ccc
site2.com,output1
site3.com,rrr,uuu,ppp
site4.com,output1
site5.com,output1
cmd1
should be run with the first field as argument, right? – Stéphane Chazelas 16 hours agocsvtool
). – Konrad Rudolph 13 hours ago