From mboxrd@z Thu Jan 1 00:00:00 1970 From: zavandi Subject: Re: deleting N lines of many files Date: Fri, 17 Dec 2004 15:07:45 +0200 Message-ID: <321aa0d204121705077f40e765@mail.gmail.com> References: <41C2D20A.70404@fcaglp.unlp.edu.ar> Reply-To: zavandi Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <41C2D20A.70404@fcaglp.unlp.edu.ar> Sender: linux-admin-owner@vger.kernel.org List-Id: Content-Type: text/plain; charset="us-ascii" To: linux-admin@vger.kernel.org Fabio Zyserman wrote: > I have about eighty directories, > called data-nn, where nn=00,01,02,.... > in each of these directories I have > among others, an (ascii) data file with many thousends > lines. This data file has the same name in all > directories. > > I would like to know if it is possible, > via a bash script, to delete the first N > lines in this data file in all directories. > The modified file can overwrite the old one. Maybe you want something along the lines of (not tested!): for i in `seq -w 0 80`; do sed -i "1,${N}d" $i/filename; done