Operating System - HP-UX
1834533 Members
2603 Online
110069 Solutions
New Discussion

Re: sed in HP-UX does NOT support escapes!

 
SOLVED
Go to solution
Fedon Kadifeli
Super Advisor

sed in HP-UX does NOT support escapes!

I need to quickly translate a text file having lines ending with LF to CR+LF. The following pipe command

sed "s/$/\r/g"

does not work in HP-UX as expected, since sed in HP-UX does seem to support escape sequences.

Any suggestions?
3 REPLIES 3
Laurent Menase
Honored Contributor
Solution

Re: sed in HP-UX does NOT support escapes!

x=$(echo "\r\n")
sed -e "s/$/$x/"

Fedon Kadifeli
Super Advisor

Re: sed in HP-UX does NOT support escapes!

That was nice Laurent. Thank you!

Note: Even

sed "s/$/$(print "\r\n")/"

works!
Dennis Handly
Acclaimed Contributor

Re: sed in HP-UX does NOT support escapes!

You can also use a command that is made for this purpose, ux2dos(1).