On Fri, Sep 16, 2011 at 12:12 AM, Jochen Spieker <m...@well-adjusted.de>wrote:
> lina: > > > > for i in a b c > > do > > txt2pdf -input i.txt -out i.pdf > > done > > You almost nailed it: > > for i in a b c ; do > txt2pdf -input ${i}.txt -out ${i}.pdf > done > > > Instead of listing the files manually, you can use '*' as a wildcard. > But that only works if your filenames don't contain whitespace. A more > robust solution: > There is no whitespace in those filenames, but the situation is a bit different, here we have .txt file and also .log files and only .txt files are expected to convert, > > find /dir/to/files -type f -print0 | \ > xargs -0 -I§ txt2pdf -input § -out §.pdf > only succeed in transforming one of them, the rest just terminated. > > This will produce filenames like "a.txt.pdf", but you get the idea. > xargs hast the additional benefit that you can use multiple cores at > once when using the -P option. > Thanks for your suggestion. > > J. > -- > Tony Blair is a hypnotised self-seeking scarecrow just like all the > rest. > [Agree] [Disagree] > <http://www.slowlydownward.com/NODATA/data_enter2.html> > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > > iEYEARECAAYFAk5yI90ACgkQ+AfZydWK2zn5mQCeOqr64RuEmnTCYOmvTcg1VIaZ > Fr4An03om7IAjsPt0Q3+tBj5seF/BtD0 > =G1BX > -----END PGP SIGNATURE----- > > -- Best Regards, lina