[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: removing lines from a file



On Sat, Nov 02, 2002 at 02:19:38PM -0600, Lance Hoffmeyer wrote:
> I know this has come up before but what is the best
> way to remove lines 5-10 and lines 16-20 from
> a file using the console and a batch file?

In place? Put the following in a batch script:

#!/bin/bash
ed $1 <<!EOF
16,20d
5,10d
w
q
!EOF


Note that you need to work backwards so the line numbers don't change.

-- 
"Exhilaration is that feeling you get just after a great idea hits you,
and just before you realize what's wrong with it."
		-- Anonymous
    Rick Pasotto    rickp@telocity.com    http://www.niof.net



Reply to: