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
Replacing Text in Text file cgilchrist Shell Programming and Scripting 3 06-30-2008 11:32 PM
replacing strings with text from other file mc1392 Shell Programming and Scripting 1 03-24-2008 03:46 PM
replacing a nul field with text DarkHound Shell Programming and Scripting 3 09-04-2007 03:34 PM
Replacing text chrchcol Shell Programming and Scripting 3 07-25-2006 01:30 PM
replacing text ajaya Shell Programming and Scripting 2 04-12-2006 01:31 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-05-2008
Angelseph Angelseph is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 3
replacing text in a file, but...

Hi all,

Very first post on this forums, hope you can help me with this scripting task.

I have a big text file with over 3000 lines, some of those lines contain some text that I need to replace, lets say for simplicity the text to be replaced in those lines is "aaa" and I need it to replace it for something else...
but before you think of sed's substitution 's///' or python's s.replace() method or similar ways, the resulting text should NOT be the same for every occurrence of "aaa", that is, I need the replacements to be unique (this does not happens with the above functions as all of the occurrences are replaced with the same text.

For example, for the first occurrence of "aaa" replace it with "aaa1", the second "aaa2" and so forth. I doesn't necessarily have to be sequential it just has to be unique.

Any input is appreciated,
Thank you.
 

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 06:31 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