Re: Sed in FreeBSD

2008-07-06 Thread Glen Barber
On 7/5/08, James Bailie <[EMAIL PROTECTED]> wrote:
> Sebastian Tymków wrote:
>
>
> > I've tried with sed -e '/PATTERN/ a\ line' file but this did'n work. There
> > are many axamples in internet but none
> > of them work on FreeBSD.
> >
>
>  The inserted line needs to be on a separate physical line.
>
>  sed -e '/PATTERN/a\
>  line'
>
>  For /bin/csh, you need two backslashes because the shell recognizes
>  backslashes inside single-quotes, which it shouldn't.
>

IIRC, you also need the '-i' flag, even if you do not specify a backup
extension:

sed -i '' -e 's/foo/bar/' myfile

http://www.dev-urandom.com/unix/sed

Regards,


-- 
Glen Barber
http://www.dev-urandom.com/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Sed in FreeBSD

2008-07-05 Thread James Bailie

Sebastian Tymków wrote:


I've tried with sed -e '/PATTERN/ a\ line' file but this did'n work. There
are many axamples in internet but none
of them work on FreeBSD.


The inserted line needs to be on a separate physical line.

sed -e '/PATTERN/a\
line'

For /bin/csh, you need two backslashes because the shell recognizes
backslashes inside single-quotes, which it shouldn't.

--
James Bailie <[EMAIL PROTECTED]>
http://www.mammothcheese.ca
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Sed in FreeBSD

2008-07-05 Thread Sahil Tandon
Sebastian Tymk?w <[EMAIL PROTECTED]> wrote:

> I'm trying to use sed in script to append file after pattern but I couldn't
> find any good example
> how can I do it.

Based on sed(1), I think you need something like:

sed '/PATTERN/ r file' 

-- 
Sahil Tandon <[EMAIL PROTECTED]>
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Sed in FreeBSD

2008-07-05 Thread andrew clarke
On Sat 2008-07-05 16:06:39 UTC+0200, Sebastian Tymk?w ([EMAIL PROTECTED]) wrote:

> I'm trying to use sed in script to append file after pattern but I couldn't
> find any good example how can I do it.
> I've tried with sed -e '/PATTERN/ a\ line' file but this did'n work. There
> are many axamples in internet but none of them work on FreeBSD.

I'm not too familiar with sed and so am unsure what you're trying to.

It looks as though BSD sed is supplied with in the FreeBSD base
system.  You might want to try GNU sed instead.  It's in the Ports
tree - textproc/gsed.

If neither of them work for you then you've probably made a mistake
with your input.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Sed in FreeBSD

2008-07-05 Thread Sebastian Tymków
Hi,

I'm trying to use sed in script to append file after pattern but I couldn't
find any good example
how can I do it.
I've tried with sed -e '/PATTERN/ a\ line' file but this did'n work. There
are many axamples in internet but none
of them work on FreeBSD.

Best regards,

Sebastian Tymkow
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"