Re: Multiple files
Daniel D Jones <ddjones@riddlemaster.org> writes:
> How does one handle multiple files via most command line utilities? For
> example, suppose you have a handful of perl scripts (*.pl) and you want
> to save them in the same directory with a different extension. The
> command
>
> cp *.pl *.bak
for f in *.pl; do cp $f ${f%.pl}.bak; done
for f in *.pl; do cp $f `basename $f .pl`.bak; done
> sed s/^M// *.pl > *.unix
for f in *.pl; do sed s/^m// $f > ${f%.pl}.unix; done
for f in *.pl; do sed s/^m// $f > `basename $f .pl`.unix; done
perl -pi.bak -e 's/^M//' *.pl
The last one doesn't do exactly what you suggest; it edits the files in
place, but leaves the originals in another file with a .bak extension.
--
Dave Carrigan (dave@rudedog.org) | Yow! Kids, the seven basic food
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-DNS | groups are GUM, PUFF PASTRY,
Seattle, WA, USA | PIZZA, PESTICIDES, ANTIBIOTICS,
http://www.rudedog.org/ | NUTRA-SWEET and MILK DUDS!!
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: