The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to grep certain pattern aoussenko Shell Programming and Scripting 5 05-15-2009 11:58 AM
Pattern Matching - serach and replace script bsandeep_80 UNIX for Dummies Questions & Answers 10 04-08-2009 01:29 AM
serach and replace a specific pattern or value in a xml file kiranreddy1215 Shell Programming and Scripting 1 08-13-2008 01:21 PM
how to grep the pattern ? faviji Shell Programming and Scripting 2 08-12-2008 09:37 AM
How to grep this pattern?? askumarece Shell Programming and Scripting 13 02-20-2008 07:03 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-14-2009
KiranKumarKarre KiranKumarKarre is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 62
pattern serach using grep

Frds
I have to search for a string which is starting with brighton which will be first in the line of a text file test1.txt. The contents of test1.txt are file names like

-----
brighton
brighton_gt
hst_brighton
gst_brighton
-------so many files------
---------
i have retrieve only brighton,brighton_gt like files only. First occurance should be brighton. i am using grep command but it is giving all the file names which are having brighton whether it comes first or middle. can any one suggest ..

Thanx
  #2 (permalink)  
Old 06-14-2009
KevinADC KevinADC is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2008
Posts: 731
Mate, at least post your current code so people can see what you have tried, it probably just needs a small tweak (adjustment) to make it work.
  #3 (permalink)  
Old 06-14-2009
rmoncello's Avatar
rmoncello rmoncello is offline
Registered User
  
 

Join Date: Feb 2009
Location: Frisco, TX
Posts: 22

Code:
[rick@kangaroo ~]$ cat test1.txt
-----
brighton
brighton_gt
hst_brighton
gst_brighton
-------so many files------
---------
[rick@kangaroo ~]$ grep "^brighton" test1.txt
brighton
brighton_gt
[rick@kangaroo ~]$

  #4 (permalink)  
Old 06-14-2009
ameya_joshi ameya_joshi is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 3
Hi

Thanks

Last edited by ameya_joshi; 06-14-2009 at 08:43 AM.. Reason: forgot to thank
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0