Skip site navigation (1)Skip section navigation (2)
Date:      23 Jan 2002 17:22:38 -0600
From:      Zach Garner <zach@neurosoft.org>
To:        freebsd-questions@freebsd.org
Subject:   Sed compatibility with GNU Sed
Message-ID:  <1011828158.44952.4.camel@minsky.zachgarner.com>

next in thread | raw e-mail | index | archive | help
In GNU Sed (textproc/gsed), I can execute the following command which
will insert "asdf" on the first line of the contents of file foo:
    gsed -e '1i\' -e 'asdf' <foo

This does not work in the sed that comes with FreeBSD. Instead, the only
way I have been able to do the above is by separating the command on two
lines:
    sed -e '1i\
        asdf' < foo


Having to use multiple lines makes it difficult to include in a
Makefile. 

I have seen sed scripts with something like "sed -e '1i\asdf' < foo"
But this gives an error saying that there are extra characters after the
backslash at the end of i command

Does anyone have any recommendations on how to do this?


Thanks,
Zach Garner




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?1011828158.44952.4.camel>