From: Owens, Blaine C - Eastman (bowens@eastman.com)
Date: Thu Jul 31 2003 - 13:20:00 EDT
Many correct answers to this one, obviously this is a FAQ. I'm attaching
one of the best responses, this one from Joe Rice. Thanks to all.
-----Original Message-----
From: Joe Rice [mailto:jrice@abnamroinc.com]
Sent: Thursday, July 31, 2003 12:54 PM
To: Owens, Blaine C - Eastman
Subject: Re: How to search for a string containing \
# echo '\' > test.txt
# grep '\\' test.txt
\
#
the key here is to escape the \ with another \
Also, use '\\' (single quote) instead of "\\" (double quote)
because of the way the shell will interpret the \ in a double quote.
# awk '/\\/ { print $0 }' test.txt
/
#
# perl -ne 'if ( /\\/ ) { print }' test.txt
/
hope this helps.
joe rice
>>> "Owens, Blaine C - Eastman" <bowens@eastman.com> 07/31/03 09:03AM
>>>
How do you grep for a string in file which literally contains the \
character? Thanks.
Blaine Owens
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:26:50 EDT