Computing.Net > Forums > Unix > Help on grep command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help on grep command

Reply to Message Icon

Name: Chinmaya
Date: April 17, 2006 at 23:22:43 Pacific
OS: Unix
CPU/Ram: 258
Product: HP -UX
Comment:

Hi

Suppose a file F1 conatins following entries

ABCD0B
ABCD0Bs
ABCD0B.ksh

I would like to grep the word that contains only '0B' as last 2 charcaters.

When I tried grep command : grep '0B' F1
it results me following lines

ABCD0B
ABCD0Bs
ABCD0B.ksh

where I wanted , result should be only the line ABCD0B.

I tried grep with pattern ????0B , that also has not given me correct result.

Can any one help me, what pattren I have to use with grep command to get the correct result.


Thanks and Regards
Chinmaya



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: April 18, 2006 at 03:14:41 Pacific
Reply:

check the man page of your grep command. for me, my grep command has the -E option which can be used for regular expression.
For me, the command is
grep -E "0B$" F1


0

Response Number 2
Name: Chinmaya
Date: April 18, 2006 at 20:23:41 Pacific
Reply:

Hi

Many thanks for your command. It gives me exact result , what I wanted

Thanks and Regards
Chinmaya


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Help on grep command

plz help me, stuck on grep prob www.computing.net/answers/unix/plz-help-me-stuck-on-grep-prob/4876.html

need help on SED script www.computing.net/answers/unix/need-help-on-sed-script/7487.html

Help on SCO Unix Network www.computing.net/answers/unix/help-on-sco-unix-network/2193.html