Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
google site



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 !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #8  
Old 12-29-2009
Registered User
 

Join Date: Oct 2008
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you so much. Scrutinizer, your solution is what I was attempting but I missed the 2 at the end, can someone please explain the trailing 2 on his solution?
Sponsored Links
  #9  
Old 12-29-2009
root cause analyst
 

Join Date: Nov 2008
Location: Amsterdam
Posts: 1,770
Thanks: 5
Thanked 78 Times in 75 Posts
Hi,

Instead of using a "g" for global replacement, putting a number "n" there only replaces the n-th occurence of a pattern, in this case the second digit, since the number 2 was specified and the pattern is a digit.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replace a random string of numbers ryandegreat25 Shell Programming and Scripting 5 12-09-2009 01:02 AM
using sed to replace a specific string on a specific line number using variables todd.cutting Shell Programming and Scripting 2 08-13-2009 09:40 PM
awk - replace number of string length from search and replace for a serialized array otrotipo Shell Programming and Scripting 1 07-10-2009 12:04 PM
ksh: random number between 1-10 dangral Shell Programming and Scripting 2 04-02-2009 02:52 PM
Replace a certain string with string containing random rubbish MilanCZ Shell Programming and Scripting 2 03-11-2009 09:57 AM



All times are GMT -4. The time now is 07:46 AM.