[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: automated editing of text files



On Fri, Sep 16, 2011 at 05:24:52PM +0200, Bonno Bloksma wrote:

> linbobo:~/sedtest# sed 's_\n<pre>\n_\n<pre>\n\n_' <original.txt >new.txt
> linbobo:~/sedtest# less new.txt

You want to change the regexp here. In regular expressions '^' matches
start of line and '$' matches end of line. Your sed instruction above
should be something like 's/^<pre>$/<pre>\n/', or more generally
's/^\(<pre>\)$/\1\n/'.

Cheers,
Tom

-- 
The only problem with being a man of leisure is that you can never stop
and take a rest.

Attachment: signature.asc
Description: Digital signature


Reply to: