Mailing List Archive


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

Re: [tlug] Re: bash question



On Tue, Feb 18, 2003 at 02:58:12PM +0100, Tobias Diedrich wrote:
> bruno raoult wrote:
> 
> > Just by googling 5 minutes, I found this solution, which works (i.e. it
> > merges lines 1 & 2).
> > 
> > sed -e "1 N;s/\n/ /"
> 
> Interesting. I would not have this expected to work because
> sed -e 's/\n/ /'
> does nothing, but it actually does work...

Yep, I missed that one.  *wipes the egg off his face* It was a simple search to.  Anyway,
the reason it works is that sed removes the newlines at the end of the line
before processing, and puts them back on after processing. It is however possible
to match against a newline, and sed doesn't touch embedded newlines before processing.

Unfortunately, the sed manual on NetBSD is less than forth coming about what a
pattern space is in sed space making the manual a chore to read.

--Matt


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links