LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-08-2003, 05:51 AM   #1
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Rep: Reputation: 30
Advanced GREP technique ?


I've been doing quite a number of bash scripts in these last months of using linux. In most of them I make use of the 'grep' command. However I've encountered a situation where my basic knowledge of grep cannot help me that much. Suppose I have a table show below:

1,USA,aaa
2,USAX,bbb
3,USAY,ccc

What if I want to grep for the USA only? doing a normal grep "USA" will give you all the three entries, whereas doing grep -o "USA" will display nothing because the pattern "USA" is not alone....

Is there a way to go around it??
 
Old 10-08-2003, 06:14 AM   #2
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
grep USA\,
 
Old 10-08-2003, 06:55 AM   #3
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Original Poster
Rep: Reputation: 30
thanks I have just figured it just at this moment. By the way, it even works without the backslash.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
grep ?? can grep us variables? DaFrEQ Linux - Software 4 09-14-2005 12:22 PM
A question related to DVD burning technique babyboss Linux - Hardware 8 08-15-2005 04:19 AM
Back up technique for one-time re-install rickh Fedora 3 07-07-2005 04:49 PM
Symlink or Mount or Another Technique? jalperin Linux - Newbie 1 08-26-2004 06:43 PM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 11:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration