[ale] Batch processing text files
Chuck Huber
chuck at cehuber.org
Fri Dec 7 10:33:19 EST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Message: 8
> Date: Thu, 6 Dec 2007 22:29:05 -0800
> From: Joe Bayes <jbayes at spoo.mminternet.com>
> Subject: Re: [ale] Batch processing text files
> To: "Atlanta Linux Enthusiasts" <ale at ale.org>
>
> Jerry Yu writes:
>
>> >dos2unix converts the file in-place, therefore the structure ( assume you
>> >meant directory structure) is intact.
>
> But I thought he wanted the structure in a new location, not replacing
> the old one.
>
> I would do the following:
>
> mkdir converted
> tar cf - in |(cd converted ; tar xf -)
> cd converted
> find ./ -type f -exec unix2dos "{}" \;
Here's a short script that will accomplish what you seek:
# create a mirror directory structure under ../converted
for d in `find . -type d` ; do mkdir -p ../converted/$d ; done
# Convert each file within the structure
for f in `find . -type f` ; do
unix2dos --newfile $f ../converted/$f ;
done
Enjoy,
- Chuck
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHWWewiR3HaLbYCa4RApUTAKCtJcuvT/uGs2G9WurBbzWnFPFwvQCeLivE
xP5x+hBYkl4rCMR7WhxW3Ks=
=d5la
-----END PGP SIGNATURE-----
More information about the Ale
mailing list