I have the following awk script used to change the output to display 4 columns from an imput file with 1 column:
BEGIN {
if (cols == ""
cols=4;
}
{ printf("%-20s ", $1, $2, $3, $4"\n" }
!(FNR % cols) {print "\n"}
The output displays like the example below:
c00001 c00015 c00017 c00049
c01234 c01231 c01321 c00123
Can someone please explain to me what I am doing wrong?
Thanks,
John
BEGIN {
if (cols == ""
cols=4;
}
{ printf("%-20s ", $1, $2, $3, $4"\n" }
!(FNR % cols) {print "\n"}
The output displays like the example below:
c00001 c00015 c00017 c00049
c01234 c01231 c01321 c00123
Can someone please explain to me what I am doing wrong?
Thanks,
John