Cory Petkovsek wrote:
> For instance, let's say I wanted to append a '>' to the beginning of every
> line in a file. This might be done with a command line as:
> cat file1 | rep -o \> x > file2
> where x denotes the location of each line (ie \> before the line), and -o
> means output instead of execute.
Patrick Wade already gave you the answer, which is to use sed.
To prepend ">" to each line in file1, you'd do:
sed 's/^/>/' file1 > file2
Here are your other examples.
> cat file1 | rep -o \< x \> > file2
> <Hi everyone,>
> <I'm looking for a console>
sed 's/.*/<&>/' file1 > file2
> find | rep cat x '\| rep -o \\\< x \\\> \> file2'
I'm not sure what you want to do. You want to find all files and
create a new file like each file with every line bracketed, right?
If I understand the problem (-:, this will solve it.
find . -type f | sed 's/.*/sed "s+.*+<\&>+" & > &.new/' | sh
Take a look at that quoting. Very few backslashes. (-:
Take the sh command off the end to see better what it's doing.
find . -type f | sed 's/.*/sed "s+.*+<\&>+" & > &.new/'
outputs this:
sed "s+.*+<&>+" ./dir1/file1 > ./dir1/file1.new
sed "s+.*+<&>+" ./file2 > ./file2.new
--
K<bob>
[EMAIL PROTECTED], http://www.jogger-egg.com/