[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cat
From: |
Carroll, Jim |
Subject: |
cat |
Date: |
Mon, 13 May 2002 13:54:41 -0400 |
Sample text file: file.txt
--------------------
Hello
there
-------------------
run:
cat file.txt | egrep -e "o$"
you will get nothing
run:
egrep -e "o$" file.txt'
you will get "Hello"
run:
egrep -e "^" file.txt | egrep -e "o$"
you get "Hello"
if you compare the result of runing:
cat file.txt
with:
egrep -e "^"
they look the same.
It seems 'cat' is chaning the output such that 'egrep' (grep -E) can't match
the end-of-line marker correctly. Interestingly enough if you dont include a
carrage return after the 'there' in the file then it seems to pick up 'cat
file.txt | egrep -e "e$"' just fine or if you try this: 'cat file.txt | egrep
-e "$"' it also seems to do what you would expect.
For the time being I have replaced cat.exe with a shell script as follows:
---------------------------
#!/bin/sh
egrep -e "^" $1
--------------------------
and that seems to be working for me. But this does seem like a bug.
Jim Carroll