Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Mar 1999 08:09:23 +0000
From:      Mark Ovens <marko@uk.radan.com>
To:        cjclark@home.com
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: sed and newlines
Message-ID:  <36F0B4B3.9A6C8AF0@uk.radan.com>
References:  <199903172339.SAA06674@cc942873-a.ewndsr1.nj.home.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Crist J. Clark" wrote:
> 
> The sed manpage says,
> 
> Sed Regular Expressions
>      The sed regular expressions are basic regular expressions (BRE's, see
>      regex(3) for more information).  In addition, sed has the following two
>      additions to BRE's:
>      .
>      .
>      .
>      2.   The escape sequence \n matches a newline character embedded in the
>           pattern space.  You can't, however, use a literal newline character
>           in an address or in the substitute command.
> 
> If I am reading this correctly,
> 
> % sed 's/\n/   /' file
> 

I would say that this is using a literal newline in the substitute
command, which, as you quote above, is explicitly forbidden. If my
understanding of sed is correct it processes one line at a time and
what you are trying to do is concatenate the current line and the
following one (which isn't in the pattern space).

> Should take the file and subsitute three spaces in place of every
> newline. However, it does not. It does not seem to understand '\n.'
> 
> In spite of what it says, I have tried literal newlines (with \ and
> ^V), and as claimed on the manpage, it does not work (it will
> generate errors).
> 
> Am I missing something obvious? Or is sed broken?
> 
> Thanks.
> --
> Crist J. Clark                           cjclark@home.com
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
      FreeBSD - The Power To Serve http://www.freebsd.org
      My Webpage http://www.users.globalnet.co.uk/~markov
_______________________________________________________________
Mark Ovens, CNC Apps Engineer, Radan Computational Ltd. Bath UK
CAD/CAM solutions for Sheetmetal Working Industry
mailto:marko@uk.radan.com                  http://www.radan.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36F0B4B3.9A6C8AF0>