Hi,
Suppose I have a file.
Code:
$ cat dat
1,newport , ,5.38
2,sydnenham, 58894,2.12
How can I tell gawk to print column $1,$2 but if column $3 is blank to ignore spaces and output just ,, (with no spaces) else print values $3 $4
I tried something like this but I don't think it's right
Code:
#!/bin/bash
gawk 'BEGIN { FS=OFS=","}
{if ($3 == " ") print $1,$2,FS,$4 ; else print $1,$2,$3,$4}'
Thanks