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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
get only two letter from any string rinku Shell Programming and Scripting 2 01-18-2008 03:07 AM
what is dead.letter ?? jambesh Shell Programming and Scripting 2 08-30-2006 12:25 AM
how to read each letter from file and store it in variable. rajan_ka1 UNIX for Advanced & Expert Users 7 03-06-2006 06:03 PM
SORT by letter murbina UNIX for Dummies Questions & Answers 1 05-12-2004 10:04 AM
dead.letter unisam UNIX for Dummies Questions & Answers 6 03-30-2004 11:33 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-04-2008
Registered User
 

Join Date: Jan 2008
Posts: 9
Exclamation using sed to add letter after variable

Hi All,

I need to have a sed command insert the letter i at the end of some lines in a file.

Problem is that where I want to add the i is after variables that change in each file

eg, tsal314384'
tsal315386'
tsal317392'

I need to have it like this

tsal314384i'
tsal315386i'
tsal317392i'

so the problem is that the six numbers at the end of the line are never the same. Can anyone help ?

Jeremy
Reply With Quote
Forum Sponsor
  #2  
Old 02-04-2008
Moderator
 

Join Date: Dec 2003
Location: /dev/fl
Posts: 1,061
Try this. It places 'i' before the single quote at the end of your lines per your example

Code:
sed  "s/\'$/i'/g" file
Reply With Quote
  #3  
Old 02-04-2008
Registered User
 

Join Date: Jan 2008
Posts: 9
Exclamation

hi fpmurpy

Thanks for getting onto it so quick.

This has worked to some extent but now I have this problem

tsal314384'i' instead of tsal314384i'

Do you know what is happening here.

Jeremy
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0