Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Feb 2009 09:57:13 +0000
From:      Mike Clarke <jmc-freebsd2@milibyte.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: insert new line in files
Message-ID:  <200902070957.13650.jmc-freebsd2@milibyte.co.uk>
In-Reply-To: <498CCBA9.6010207@gmail.com>
References:  <498CBEBE.7080702@gmail.com> <20090206232129.GB75180@dan.emsphone.com> <498CCBA9.6010207@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 06 February 2009, Adam Vande More wrote:

> Progress is being made as it works in the test now with the \\
> however I'm running into more things I don't understand in regards to
> what I need to escape in my input string.

Whether to use \ or \\ will depend on your shell. You can avoid 
dependence on the shell by using a sed script, e.g.

curlew:/tmp% cat test.txt
1
2
3
4
5
6

curlew:/tmp% cat test.sed
#! /usr/bin/sed -f
5i\
test
curlew:/tmp% ./test.sed test.txt
1
2
3
4
test
5
6

-- 
Mike Clarke



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902070957.13650.jmc-freebsd2>