View Single Post
  #5  
Old 03-26-2007, 08:54 PM
unix unix is offline
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: AWK for Windows XP?

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.

--
Greetings
Matthias
Reply With Quote