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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding characters to lines 2

Status
Not open for further replies.
Apr 13, 2004
316
US
Say I have a list like the following:

IBM.PSSP.SP_HW.NodeExp.fanfail1
IBM.PSSP.SP_HW.NodeExp.envLED
IBM.PSSP.SP_HW.NodeExp.codeVersion
IBM.PSSP.SP_HW.NodeExp.ampP5B_Mod4Range
IBM.PSSP.SP_HW.NodeExp.ampP5A_Mod4Range
IBM.PSSP.SP_HW.NodeExp.ampP3_3B_Mod3Range
IBM.PSSP.SP_HW.NodeExp.ampP3_3B_Mod2Range
IBM.PSSP.SP_HW.NodeExp.ampP3_3B_Mod1Range
IBM.PSSP.SP_HW.NodeExp.ampP3_3A_Mod3Range
IBM.PSSP.SP_HW.NodeExp.ampP3_3A_Mod2Range
IBM.PSSP.SP_HW.NodeExp.ampP3_3A_Mod1Range
IBM.PSSP.SP_HW.NodeExp.ampP12B_Mod5Range
IBM.PSSP.SP_HW.NodeExp.ampP12A_Mod5Range
IBM.PSSP.SP_HW.NodeExp.ampN12B_Mod6Range
IBM.PSSP.SP_HW.NodeExp.ampN12A_Mod6Range
IBM.PSSP.SP_HW.NodeExp.VoltP5Range
IBM.PSSP.SP_HW.NodeExp.VoltP3_3Range
IBM.PSSP.SP_HW.NodeExp.VoltP12Range
IBM.PSSP.SP_HW.NodeExp.VoltN12Range
IBM.PSSP.SP_HW.NodeExp.P48OK
IBM.PSSP.SP_HW.NodeExp.DASDspinupFail
IBM.PSSP.SP_HW.Node.warningTemp

What I want to do is to have it written out like so:

‘IBM.PSSP.SP_HW.NodeExp.fanfail1’ ‘IBM.PSSP.SP_HW.NodeExp.envLED’ ‘IBM.PSSP.SP_HW.NodeExp.codeVersion’ ‘IBM.PSSP.SP_HW.NodeExp.ampP5B_Mod4Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampP5A_Mod4Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampP3_3B_Mod3Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampP3_3B_Mod2Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampP3_3B_Mod1Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampP3_3A_Mod3Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampP3_3A_Mod2Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampP3_3A_Mod1Range’ \
‘IBM.PSSP.SP_HW.NodeExp.ampP12B_Mod5Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampP12A_Mod5Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampN12B_Mod6Range’ ‘IBM.PSSP.SP_HW.NodeExp.ampN12A_Mod6Range’ ‘IBM.PSSP.SP_HW.NodeExp.VoltP5Range’ ‘IBM.PSSP.SP_HW.NodeExp.VoltP3_3Range’ ‘IBM.PSSP.SP_HW.NodeExp.VoltP12Range’ ‘IBM.PSSP.SP_HW.NodeExp.VoltN12Range’ ‘IBM.PSSP.SP_HW.NodeExp.P48OK’ ‘IBM.PSSP.SP_HW.NodeExp.DASDspinupFail’ ‘IBM.PSSP.SP_HW.Node.warningTemp’
Thanks!!
 
sed -e "s/^.*$/\'&\' \\\/g" myFile.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
The sed way:
sed -e "s!^!'!;s!\$!'\\\\!" /path/to/input >output
The awk way:
awk "{print \"'\"\$0\"'\\\\\"}" /path/to/input >output

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top