The UNIX Forums
"Join the Network of UNIX System Users"


 
Subject: put strings around the file name
kodut
Newbie
Rank: 1



UID 226
Digest Posts 0
Credits 0
Posts 33
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:16 AM  Profile | P.M. 
put strings around the file name



put strings around the file name



i have a file(old file) with names in it like
jolly mirani
han lee
stuart lloyd

i want string to be added to these names . new file should look like
'jolly mirani'
'han lee'
'stuart lloyd'

i tried using sed command but doesn't work for string but it do work for paranthesis. can some one help me with the code for the same.

sed 's/[^][^]*/(&)/g' <old file> new file


Top
DomainDomain
Newbie
Rank: 1



UID 120
Digest Posts 0
Credits 0
Posts 48
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 20, 2007 10:17 AM  Profile | P.M. 
another:

code:

awk ' {  $0 = tolower($0); print "\047"$0"\047"} ' "file"
output:

code:

# ./test.sh
'jolly mirani'
Top
 

 

All times are GMT, the time now is Mar 21, 2010 04:24 PM

Powered by Discuz! 5.0.0  © 2001-2006 UNIX Forums
Processed in 0.019788 second(s), 8 queries

Clear Cookies - Contact Us - UNIX Help - Archiver - WAP