Re: deleting N lines of many files

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

 



At 12/17/2004 09:33 AM -0300, 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.

Something like:

for file in data-[0-9][0-9]/filename
do
temp="${file}-temp"
tail +N "$file" > "$temp" && mv "$temp" "$file"
done

--
Jeff Woods <kazrak+kernel@xxxxxxxxxxx>



- : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux