The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search for a pattern in part of the line pineapples Shell Programming and Scripting 6 09-10-2008 11:42 AM
search for the matched pattern by tracing back from the line Sharmila_P Shell Programming and Scripting 9 08-04-2008 09:21 AM
Multile Pattern Search in a same line and delete sasree76 Shell Programming and Scripting 2 04-16-2008 03:12 PM
Perl onliner to search the last line with an occurence of a pattern ammu Shell Programming and Scripting 4 01-31-2008 01:09 AM
Search file for pattern and grab some lines before pattern frustrated1 Shell Programming and Scripting 2 12-22-2005 03:41 PM

Closed Thread
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 10-12-2008
imas imas is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 15
modify a particular pattern starting from second line of the search pattern

Hi,

I am new to this forum and i would like to get help in this issue.

I have a file 1.txt as shown:

apple
banana
orange
apple
grapes
banana
orange
grapes
orange
....

Now i would like to search for pattern say apple or orange and then put a # at the beginning of the pattern from second line i.e, for the first matched pattern/first line ignore and then from second matched pattern/second line and so on put a # at the beginning of the pattern.

Your help is appreciated.

Thanks.
  #2 (permalink)  
Old 10-12-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,763
Match apple and every subsequent orange gets a # in front of it?
-- expected output would help a lot.
  #3 (permalink)  
Old 10-12-2008
tayyabq8's Avatar
tayyabq8 tayyabq8 is offline Forum Advisor  
Moderator
  
 

Join Date: Nov 2004
Location: Bahrain
Posts: 579
Sounds like homework, closing the thread.
Closed Thread

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 09:14 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