Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert characters in each line of a file.

Status
Not open for further replies.

schocku

Programmer
Nov 20, 2001
23
US
Simple awk/sed question.
My input file is as follows :
abc
ddfdf
fjjjjj
dffdff

I need to insert a ' at the beginning of each line and insert ', at the end of each line. So the output should look like

'abc',
'ddfdf',
'fjjjjj',
'dffdff,

Thanks in advance for your help.
 
You need to use " around the sed command eg
sed "s/^/'/; s/$/'/" yourfile >newfile

HTH

Dickie Bird (:)-)))
 
and with awk :)

awk -v QUOTE=\`
'{
print QUOTE $0 QUOTE
}'

@+
Lolo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top