[Gllug] Help with sed

Dan Kolb gllug at eco.li
Thu Aug 20 13:53:13 UTC 2009


On Thu, Aug 20, 2009 at 01:21:11PM +0100, Christopher Mocock wrote:
> Hi,
> 
[snip sed]
> 
> I haven't refined that but it's the general idea I was trying. It's the 
> newlines that seem to be the problem.

sed will change text on a line-by-line basis. So, from the man page:

     Normally, sed cyclically copies a line of input, not including its termi-
     nating newline character, into a pattern space, (unless there is some-
     thing left after a `D' function), applies all of the commands with ad-
     dresses that select that pattern space, copies the pattern space to the
     standard output, appending a newline, and deletes the pattern space.



So, for what you want, you'll need some thing else. I'm going to suggest 'ed',
and leave the ed script as an exercise for another reader.

Dan
-- 
Brain, v. [as in "to brain"]:
	To rebuke bluntly, but not pointedly; to dispel a source of
	error in an opponent.
		-- Ambrose Bierce, "The Devil's Dictionary"
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list