Y
yong321
I use GNU utilities for Win32 (http://unxutils.sourceforge.net) on
Windows XP. Combining tail -f and gawk doesn't return anything:
******************************************************
C:\>type test.txt
This is a test.
Second line.
C:\>tail -1 test.txt | gawk "{print $1}"
Second
C:\>tail -f test.txt | gawk "{print $1}"
^C^C
C:\>tail -f test.txt | gawk '{print $1}'
gawk: cmd. line:1: '{print
gawk: cmd. line:1: ^ invalid char ''' in expression
^C
C:\>tail -f test.txt 2>&1 | gawk "{print $1}"
^C^C
C:\>tail -f test.txt 1>&2 | gawk "{print $1}"
This is a test.
Second line.^C^C
******************************************************
So tail | gawk works but tail -f | gawk shows nothing, regardless
whether stderr is duplicated to stdout. Duplicating stdout to stderr
just makes gawk useless. Single quotes are not allowed.
In Cygwin (on this XP machine), using single quotes almost works as
expected (Without a carriage return at the end of the second line, gawk
in Cygwin eats that second line up):
******************************************************
$ cd /cygdrive/c
$ tail -f test.txt | gawk "{print $1}"
This is a test.
$ tail -f test.txt | gawk '{print $1}'
This
******************************************************
Can somebody advise on how to make tail -f test.txt | gawk "{print $1}"
work under DOS without using Cygwin? Thanks.
Yong Huang
Windows XP. Combining tail -f and gawk doesn't return anything:
******************************************************
C:\>type test.txt
This is a test.
Second line.
C:\>tail -1 test.txt | gawk "{print $1}"
Second
C:\>tail -f test.txt | gawk "{print $1}"
^C^C
C:\>tail -f test.txt | gawk '{print $1}'
gawk: cmd. line:1: '{print
gawk: cmd. line:1: ^ invalid char ''' in expression
^C
C:\>tail -f test.txt 2>&1 | gawk "{print $1}"
^C^C
C:\>tail -f test.txt 1>&2 | gawk "{print $1}"
This is a test.
Second line.^C^C
******************************************************
So tail | gawk works but tail -f | gawk shows nothing, regardless
whether stderr is duplicated to stdout. Duplicating stdout to stderr
just makes gawk useless. Single quotes are not allowed.
In Cygwin (on this XP machine), using single quotes almost works as
expected (Without a carriage return at the end of the second line, gawk
in Cygwin eats that second line up):
******************************************************
$ cd /cygdrive/c
$ tail -f test.txt | gawk "{print $1}"
This is a test.
$ tail -f test.txt | gawk '{print $1}'
This
******************************************************
Can somebody advise on how to make tail -f test.txt | gawk "{print $1}"
work under DOS without using Cygwin? Thanks.
Yong Huang