AWK for Windows XP? - MS-DOS
This is a discussion on AWK for Windows XP? - MS-DOS ; Hello there, Guys I need to run an awk script under Windows and therefore I am searching for awk command interpreter that works in Windows XP/2003. Is there awk for Windows environment? (I do not want to use Cygwin). Thanks...
![]() |
| | LinkBack | Tools |
|
#1
| |||
| |||
| Guys I need to run an awk script under Windows and therefore I am searching for awk command interpreter that works in Windows XP/2003. Is there awk for Windows environment? (I do not want to use Cygwin). Thanks |
|
#2
| |||
| |||
| aleu@vp.pl wrote: > Hello there, > > Guys I need to run an awk script under Windows and therefore I am > searching for awk command interpreter that works in Windows XP/2003. > > Is there awk for Windows environment? (I do not want to use Cygwin). > http://gnuwin32.sourceforge.net/packages/gawk.htm http://unxutils.sourceforge.net/ -- Greetings Matthias |
|
#3
| |||
| |||
| 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. Regards, Aleu |
|
#4
| |||
| |||
| On Mon, 26 Mar 2007 15:42:31 -0400, "aleu@vp.pl" >Hello there, > >Guys I need to run an awk script under Windows and therefore I am >searching for awk command interpreter that works in Windows XP/2003. > >Is there awk for Windows environment? (I do not want to use Cygwin). gawk - It what you would get with Cygwin or Linux, except a couple of *ix pipe features don't work. -- T.E.D. (tdavis@gearbox.maem.umr.edu) Remove "gearbox.maem." from address - that one is dead |
|
#5
| |||
| |||
| 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 |
|
#6
| |||
| |||
| On Mon, 26 Mar 2007 15:58:51 -0400, "aleu@vp.pl" >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. > In Windows, it's awk "{print $11}" test.txt Even in Unix, that is a misuse of cat - awk scripts take filenames as arguments, and can be much more useful if the file is passed as an argument since the FILENAME variable is then the name of the file being processed, multiple files can be distinguished from each other, and the input file can even be determined in a BEGIN{} block. Another interesting point about gawk and Windows: if a filespec is to be interpreted by gawk, use / as the directory separator (inside scripts, and as the argument to -f on the command line) but if they are to processed by the command interpreter, specifically the files passed as arguments to the program, use \ - use \\ in strings literal that are to be passed as part of a system() or command | getline construct. -- T.E.D. (tdavis@gearbox.maem.umr.edu) Remove "gearbox.maem" to get real address - that one is dead |
|
#7
| |||
| |||
| aleu@vp.pl > Guys I need to run an awk script under Windows and therefore I am > searching for awk command interpreter that works in Windows XP/2003. 878915 Oct 25 2003 ftp://garbo.uwasa.fi/win95/unix/UnxUpdates.zip UnxUpdates.zip Updates for UnxUtils GNU utilities for native Win32 All the best, Timo -- Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5 Department of Accounting and Business Finance ; University of Vaasa mailto:ts@uwasa.fi Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip |
|
#8
| |||
| |||
| 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) |
|
#9
| |||
| |||
| Todd Vargo wrote: > Matthias Tacke wrote: >> aleu@vp.pl wrote: >>> What am I doing wrong here? I want to display the 11th column of the >>> test.txt file. .... > I wonder if OP wanted the "11th column" or 11th line? > Don't know why I misread that :-( in pure batch this is: for /f "tokens=11" %A in (test.txt) do @echo/%A -- Greetings Matthias |
|
#10
| |||
| |||
| Matthias Tacke wrote: > Todd Vargo wrote: >> Matthias Tacke wrote: >>> aleu@vp.pl wrote: >>>> What am I doing wrong here? I want to display the 11th column of the >>>> test.txt file. > ... >> I wonder if OP wanted the "11th column" or 11th line? >> > Don't know why I misread that :-( > > in pure batch this is: > for /f "tokens=11" %A in (test.txt) do @echo/%A > Hi guys, Yes, I wanted the 11th column. Thanks a million. Regards, Aleu |
|
#11
| |||
| |||
| Ted Davis wrote: > In Windows, it's > awk "{print $11}" test.txt > > Even in Unix, that is a misuse of cat - awk scripts take filenames as > arguments, and can be much more useful if the file is passed as an > argument since the FILENAME variable is then the name of the file > being processed, multiple files can be distinguished from each other, > and the input file can even be determined in a BEGIN{} block. > > Another interesting point about gawk and Windows: if a filespec is to > be interpreted by gawk, use / as the directory separator (inside > scripts, and as the argument to -f on the command line) but if they > are to processed by the command interpreter, specifically the files > passed as arguments to the program, use \ - use \\ in strings literal > that are to be passed as part of a system() or command | getline > construct. > Thanks for the clarification. |
|
#12
| |||
| |||
| Timo Salmi wrote: > aleu@vp.pl >> Guys I need to run an awk script under Windows and therefore I am >> searching for awk command interpreter that works in Windows XP/2003. > > 878915 Oct 25 2003 ftp://garbo.uwasa.fi/win95/unix/UnxUpdates.zip > UnxUpdates.zip Updates for UnxUtils GNU utilities for native Win32 > > All the best, Timo > Thanks, this is precisely what I was looking for. Regards, Aleu |
|
#13
| |||
| |||
| Matthias Tacke wrote: > in pure batch this is: > for /f "tokens=11" %A in (test.txt) do @echo/%A Hmm, I am guessing that this will be more efficient in awk. Am I right? |
|
#14
| |||
| |||
| aleu@vp.pl wrote: > Matthias Tacke wrote: >> in pure batch this is: >> for /f "tokens=11" %A in (test.txt) do @echo/%A > > Hmm, I am guessing that this will be more efficient in awk. Am I right? Maybe, depends on preferences, the environment, size and structure of the file. -- Greetings Matthias |
![]() |
« Previous Thread
|
Next Thread »
| Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [News] [Rival] Windows Vista Sales + Windows Vista Upgrades = Windows XP | unix | Linux | 0 | 04-14-2008 03:38 AM |
| =?WINDOWS-1252?Q?2.6.24-rc3-mm1_--_arch/x86/xen/enlighten.c:591:_error:_?= =?WINDOWS-1252?Q?=91TLB=5FFLUSH=5FALL=92_undeclared_?= =?WINDOWS-1252?Q?(first_use_in_this_function)?= | unix | Kernel | 2 | 11-27-2007 05:10 PM |
| =?WINDOWS-1252?Q?manual_page_'ack_to_Inbox_Arch?= =?WINDOWS-1252?Q?iveReport_SpamDelete_More_Acti?= =?WINDOWS-1252?Q?ons_1_of_584_Older_=9B_manual_pa?= =?WINDOWS-1252?Q?ge_'man_2_fork'_wrt_file_locks?= | unix | Kernel | 1 | 11-19-2007 02:30 PM |
| =?windows-1251?B?0OXj6PHy8OD26P8g7vT0+O7w7fv1IOru7O/g7ejpIOgg4O3u7ejs7fv1?= =?windows-1251?B?IPH35fLu4iAvLy/iICDs5fDzICDoICDt6Pfl7CAg7eUg5+Dq8PvyLiAg?= =?windows-1251?B?x+Tl8fwgIPHu4vHl7CAg?= | unix | Debian | 0 | 10-06-2007 05:08 PM |
| Does every windows which shows itself while working on any Windows O.S ( lets say Windows 2k) a registered one? | unix | Programmer | 0 | 10-04-2007 06:12 PM |
All times are GMT. The time now is 10:44 AM.




