insert new line in files

Mike Clarke jmc-freebsd2 at milibyte.co.uk
Sat Feb 7 02:26:30 PST 2009


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


More information about the freebsd-questions mailing list