Re: How to remove a specific line in a file

2007-05-01 Thread Andreas Schwab
[EMAIL PROTECTED] (Bob Proulx) writes: > Matthew Woehlke wrote: >> If you need to replace the file, it is best to write to a temporary >> file and use e.g. 'mv mynewfile myfile' when you are done. > > Check out the newish sed option --in-place. It does what you want. > > $ sed --in-place $SEDCO

Re: How to remove a specific line in a file

2007-05-01 Thread Bob Proulx
Matthew Woehlke wrote: > $ sed -e '5d' -e '/FOO/d' -e '5,7d' myfile > mynewfile > > Note that redirecting output to an input file is not recommended (you > might end up truncating the file, for example). You almost certainly would. > If you need to replace the file, it is best to write to a tem

Re: How to remove a specific line in a file

2007-05-01 Thread Paul Jarc
Matthew Woehlke <[EMAIL PROTECTED]> wrote: > It seems like there should be a way to delete the first match in pure > sed, but I didn't figure it out in the few seconds testing I did. sed '/foo/{x;/^$/d;}' paul ___ Bug-bash mailing list Bug-bash@gnu.

Re: How to remove a specific line in a file

2007-05-01 Thread Matthew Woehlke
Eka1618 wrote: I am currently trying to figure out how to remove a specific line in a file. So far I've only been able to come up with Ideas such as removing blank lines, duplicate lines, or a number of line that are one right after another. I think that I should be using the commands grep

How to remove a specific line in a file

2007-05-01 Thread Eka1618
I am currently trying to figure out how to remove a specific line in a file. So far I've only been able to come up with Ideas such as removing blank lines, duplicate lines, or a number of line that are one right after another. I think that I should be using the commands grep, cat, and rm