From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Adrian C." Subject: Re: need help with a bash script Date: Tue, 19 Sep 2006 22:44:59 +0300 Message-ID: <451048BB.20204@snobu.org> References: <45104173.9080209@fcaglp.unlp.edu.ar> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <45104173.9080209@fcaglp.unlp.edu.ar> Sender: linux-admin-owner@vger.kernel.org List-Id: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: zyserman@fcaglp.unlp.edu.ar Cc: linux-admin@vger.kernel.org Fabio Zyserman wrote: > What I want to do is to create a new file, with one line from each of the > data files (say, line beginning with 0.01e00), adding to each line in > the new file the number appearing in the name of the corresponding data > file. > That is, the new file will contain one more column than the original > ones; the new > file would be > 0.01e00 .... .... .... 1.2 > 0.01e00 .... .... .... 1.3 > 0.01e00 .... .... .... 1.4 rm -f newfile for i in `ls data-*` do ls $i printf `cat "$i" | grep -i "0.01e00"` >> newfile printf ".........." >> newfile printf `basename $i | cut -d = -f 3` >> newfile printf "\n" >> newfile done well.. you get the idea. --Adrian.