delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
To: | cygwin AT cygwin DOT com |
Subject: | RE: newby stupid question - cat mutiple files to new piped output files |
Message-ID: | <OF407C236E.8FE4A989-ONC1256DEA.003DFDEA@icos.be> |
From: | "Erik Cumps" <erik DOT cumps AT icos DOT be> |
Date: | Wed, 26 Nov 2003 12:23:06 +0100 |
MIME-Version: | 1.0 |
How about: --- 8< cut here --- #!/bin/bash pushd /cygdrive/d/pc1 for file in *.csv; do if [ "${file##new_}" != "${file}" ]; then next; fi cat "${file}" | uniq > "new_${file}" done popd ------------------- I Guess bas is like perl: TIMTOWTDI ;) > Ronald Landheer-Cieslak wrote on Wednesday, November 26, 2003 12:53 PM: > > for i in /cygdrive/d/pc1/*.csv; do > cat $i | uniq > /cygdrive/d/pc1/newfilename.csv > done > > This will work once, because the new files won't be there > yet. After that, the *.csv will pick up the new files as well.. Apart from that, you will overwrite the new file each time ;-) $ for i in /cygdrive/d/pc1/*.csv; do cat $i | uniq > /cygdrive/d/pc1/$1.new; done Now you avoid that your new files are picked also and all new files have new names (a .new appended). Other approaches to do something like that: find /cygdrive/d/pc1/*.csv -exec uniq \{} \{}.new \; refer the manuals ... :) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |