sed Ampersand

I want to add the character "<" to the end of each line of input using the & function in SED.

Something like:

sed 's/.*/&\</'

It's important to use the &, not another method, because I want to know what I'm doing wrong.
Thanks

Do not leave people guessing.

What error message are you getting, if any, while trying your solution?
Or are you not getting the desired output?
What sed version are you using?

Simply do

sed 's/.*/&</'

or

sed 's/$/</'
1 Like

In the regex (pattern) part, not the replacement part. I think.

The problem was only that my file had CRLF terminators. Using fromdos solved it.

Yes, I have already deleted that from my post.

1 Like