I am formatting an input file using:
awk -v OFS="n" '{$1=$1}1' inputfile | awk '!/r/'
because the lines of my input file end with rrn
and i want to prevent empty lines in output. Is it possible to call awk
only once?
I tried:
awk -v OFS="n" '{$1=$1}!/r/' inputfile
But it seems it is applied to the initial record so the output is empty.
EDIT
I don’t know why but this works:
awk -v OFS="n" '{$1=$1; print $1}' inputfile
1