For Programmers: Free Programming Magazines  


Home > Archive > AWK > April 2007 > Re: printing FILENAME on top of selected columns only, starting from









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: printing FILENAME on top of selected columns only, starting from
Ed Morton

2007-04-04, 6:57 pm

z.entropic wrote:
> Using a command-line awk, I'd like to print a filename and, let's say,
> all the values in column 5 in each file starting from row 17.
>
> $awk ' NR += 17 {print FILENAME, $5 } ' *.out or
>
> don't do what I want it to do--and am a bit stuck ...
>
> Why, for example, inequalities don't work in this situation, e.g.,
>
> $awk 'NR > 16 { print FILENAME, $5}' *.out
>


They work just fine. What is it you expected it do do that it isn't doing?

Ed.
Ed Morton

2007-04-05, 6:58 pm

z.entropic wrote:
> On Apr 4, 9:28 am, Ed Morton <mor...@lsupcaemnt.com> wrote:
>
>
>
> I'd like to see the following output format:
>
> filename
> data1
> data2
> data3
> .
> .
> .
>
>
> instead of:
>
> filename data1
> filename data2
> filename data3
> .
> .
> .
>


awk 'FNR == 1 { print FILENAME } FNR > 16 { print $5}' *.out

Ed.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com