Mail Archives: djgpp/1998/01/11/07:44:35
On Fri, 9 Jan 1998, Weiqi Gao wrote:
> ======================================================================
> C:\TEMP> cat junk
> 123 456
>
> C:\> awk 'length($1) < 2 {print $1}' junk
> 123
> ======================================================================
>
> What am I missing here?
Did you actually run this from the DOS prompt? If so, which shell did
you use? COMMAND.COM won't let Gawk run at all, since it doesn't
understand single quotes and treats the < as an attempt to redirect
input to a file named 2. This usually fails, but if you actually have
a file by that name, the result will depend on what's in that file
(which you didn't say).
Replacing single quotes with double quotes makes this program work as
I'd expect (i.e., print nothing), since COMMAND.COM then treats < as a
normal character. The original command also works from Bash.
- Raw text -