View Single Post
  #11  
Old 03-27-2007, 01:41 PM
unix unix is offline
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: AWK for Windows XP?

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.
Reply With Quote