GAUTAM
asked on
Unix command doubt
Hi Experts...
Can anyone explain this unix command bit-by-bit.
Please help...
Can anyone explain this unix command bit-by-bit.
Please help...
Unix Command:
sed '/^$/d' $csv_file | egrep -v '(^,|^ )' | nawk -F "," '{OFS="|";print $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15}' | nawk -F "|" '{i=1; while(i<=NF) {if ($i=="") {printf (" |")} else {printf ("%s|",$i)}; i++}; printf("\n")}' | sed 's/|$//'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you provide the sample data of your csv file.
ASKER
The file is not in a CSV format, it needs to be converted to a csv for the script to work.
save the document as CSV.
save the document as CSV.
A shorter version, assuming that all of the lines you want are 15 fields long, might be
Open in new window