Unix questions - grep help

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > August 2006 > grep help





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author grep help
rogv24@yahoo.com

2006-08-29, 1:35 pm

I am trying to grep a file and I am looking for this **cool**. So I
need to search for asterisks.

When I use grep it assumes these are wild cards. How can I override
that.
Thanks

Pascal Bourguignon

2006-08-29, 1:35 pm

rogv24@yahoo.com writes:

> I am trying to grep a file and I am looking for this **cool**. So I
> need to search for asterisks.
>
> When I use grep it assumes these are wild cards. How can I override
> that.


With an escape.

echo '**cool** is it not' > a
echo 'not cool, is it' >> a
grep '\*\*cool\*\*' a

--
__Pascal Bourguignon__ http://www.informatimago.com/

ATTENTION: Despite any other listing of product contents found
herein, the consumer is advised that, in actuality, this product
consists of 99.9999999999% empty space.
hondza

2006-08-29, 1:35 pm

On 2006-08-29, rogv24@yahoo.com <rogv24@yahoo.com> wrote:
> I am trying to grep a file and I am looking for this **cool**. So I
> need to search for asterisks.
> When I use grep it assumes these are wild cards. How can I override
> that.


Either

#v+
grep '\*\*cool\*\*'
#v-

or

#v+
grep -F '**cool**'
#v-

> Thanks


You should read the manual, it's all in it.

--
hondza aka "kinderzrout" | GPG key: http://www.hondza.adslink.cz/key.asc
Fingerprint: 31E7 EF56 7280 5C89 75E9 FF9D 010E 175F 7823 CF38
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com