Re: Using grep to find a string containing stars
From: Stephane Chazelas (stephane_chazelas_at_yahoo.fr)
Date: 11/25/05
- Previous message: Bit Twister: "Re: Using grep to find a string containing stars"
- In reply to: Matthieu Gaillet: "Using grep to find a string containing stars"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Nov 2005 15:03:40 GMT
On Fri, 25 Nov 2005 14:00:15 +0100, Matthieu Gaillet wrote:
[...]
> I encounter some difficulties finding the string "***" using the command
> grep under Sun's Unix Interactive (pure vintage)
>
> it seems that the star is acting as a wildcard...
>
> example : the command grep "***" file.txt reports ALL the lines of the file.
[...]
Use the "-F" flag for grep to do fixed string searches only:
grep -F '***' < file.txt
Or build a regexp that matches 3 stars:
grep '\*\*\*' < file.txt
or
grep '[*][*][*]' < file.txt
or
grep -E '\*{3}' < file.txt
-- Stephane
- Previous message: Bit Twister: "Re: Using grep to find a string containing stars"
- In reply to: Matthieu Gaillet: "Using grep to find a string containing stars"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|