View Single Post
  #8  
Old 03-27-2007, 04:09 AM
unix unix is offline
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: AWK for Windows XP?

Matthias Tacke wrote:
> aleu@vp.pl wrote:
> > Matthias Tacke wrote:
> >>
> >> http://gnuwin32.sourceforge.net/packages/gawk.htm
> >> http://unxutils.sourceforge.net/

> >
> > Matthias,
> >
> > Thanks a million for this links. I have tried the following command:
> >
> > C:\test>cat test.txt | gawk '{ print $11 }'
> > gawk: cmd. line:1: '{
> > gawk: cmd. line:1: ^ invalid char ''' in expression
> > cat: write error: Invalid argument
> >
> > What am I doing wrong here? I want to display the 11th column of the
> > test.txt file.
> >

> Hi Aleu,
> the single quotes have no special meaning in the cmd shell. Replace them
> with double quotes.
>
> Btw the command doesn't get the 11 line but the elenth word/token of the
> lines, but I'm no awk guru ;-)
>
> A pure batch soluition to print the eleventh line:
>
> set x=
> for /f "skip=10 delims=" %A in (test.txt) do @if not defined x
> (@echo/%A)&set x=x
>
> That are two lines for direct input to the shell.


I wonder if OP wanted the "11th column" or 11th line?

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

Reply With Quote