David Allen <[EMAIL PROTECTED]> wrote:
> My apologies for asking on this list, but I'm stuck without Perl and need
> to use awk to generate a report.
>
> I'm working with a large data set spread across multiple files, but to
> keep things simple, say I have A Very Long String that containing records,
> each delimited by a single space. I need to print those records in
> columnar format, but with only 7 columns per line:
>
> record1 record2 record3 record4 record5 record6 record7
> record08 record09 record10 record11 record12 record13 record14
> ...
A small sh script:
#!/bin/sh
awk ' {
for (i=1; i<=NF; i++) {
printf("%s ", $i)
if (i % 7 == 0) { printf("\n") }
}
if (NF % 7 != 0) { printf("\n") }
} ' input
--
Sahil Tandon <[EMAIL PROTECTED]>
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"