[plug] A sed question?

Matt Kemner zombie at penguincare.com.au
Wed Oct 21 15:38:18 WST 2009


Hi Arie

On Wed, 21 Oct 2009, quoth Arie Hol:

> Is there a way of using sed to insert a 'backpsace' character ?

Yes, but from reading down I don't think that's what you need.

> I know how to use sed to insert  'tabspace' and 'newline' characters, but
> I can't figure out how to insert a 'backspace' character.

[...]

> I need this functionality so that I can process the output from a series
> of grep commands which are piped through 'sort' and 'uniq' into a data
> file - but there are many instances where I want/need to append one line
> of the data file to the end of the previous line.

In that case you probably want to remove the line feeds from the data (and 
being windows based, the carriage returns also) - which is easier with 
"tr" than with "sed"

tr -d '^M^J'

You enter the control-m and control-j characters by preceding them with 
control-v

I have just tested this on a windows box using cygwin.

Kind Regards,

  - Matt



More information about the plug mailing list