Does "\t" work with grep?
grep \t test.txt
I've tried enclosing the expression in single quotes and double quotes. What am I doing wrong?
(Yes, I have checked that there are tab characters in the file.)
Mac OS X (10.3.9)
Mac OS X (10.3.9)
I've tried enclosing the expression in single quotesThat should work (does for me). I just created a text file using TextEdit:
ibook:~/Desktop michaelc$ od -c tabs.txt
0000000 a \t t a b \n b \t t a b \n c \t t a
0000020 b \n
ibook:~/Desktop michaelc$ grep '\t' tabs.txt
a tab
b tab
c tab
Michael, did you install a version of grep, say with Fink?Fink? What's that? I didn't take nuffink, guv 🙂
ibook:~ michaelc$ ls -l `which grep`
-rwxr-xr-x 3 root wheel 106056 Mar 20 2005 /usr/bin/grep
Also, if I could convince you to use zsh, …You don't ever give up, do you 🙂
ibook:/usr/bin michaelc$ grep --version
grep (GNU grep) 2.5.1
Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. -P, --perl-regexp Interpret PATTERN as a Perl regular expression.
ibook:~/Desktop michaelc$ grep '\t' tabs.txt
a tab
Does "\t" work with grep?