Re: [g.l.d.user] Re: A quick Q: how do I command something in large amount

2011-09-21 Thread Arnt Karlsen
On Mon, 19 Sep 2011 11:15:08 +0700, Ivan wrote in message 86fwjtp3qr@gray.siamics.net: The following message is a courtesy copy of an article that has been posted to comp.unix.shell as well. Arnt Karlsen a...@c2i.net writes: On Fri, 16 Sep 2011 00:17:47 +0700, Ivan wrote:

Re: A quick Q: how do I command something in large amount

2011-09-18 Thread Arnt Karlsen
On Fri, 16 Sep 2011 00:17:47 +0700, Ivan wrote in message 86ehzhsp1g@gray.siamics.net: Whitespace is not a problem as long as one remembers to double-quote Shell $ubstitutions, like: for i in a b c ; do ..or, e.g.: for i in $(ls /path/to/files/*.txt ) ; do txt2pdf

[g.l.d.user] Re: A quick Q: how do I command something in large amount

2011-09-18 Thread Ivan Shmakov
The following message is a courtesy copy of an article that has been posted to comp.unix.shell as well. Arnt Karlsen a...@c2i.net writes: On Fri, 16 Sep 2011 00:17:47 +0700, Ivan wrote: [Cross-posting to comp.unix.shell for no good reason at all.] Whitespace is not a problem as long

A quick Q: how do I command something in large amount

2011-09-15 Thread lina
Hi, in some directory it has some files, let's say: a.txt b.txt c.txt d.txt I want to run a command, suppose it's txt2pdf -input a.txt -output a.pdf what if I want to do like txt2pdf -input *.txt -output *.txt I tried in bash, use for i in a b c do txt2pdf -input i.txt -out i.pdf done my

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread lina
Sorry for so many trivial description before. the Q can be simplified as: mv *.txt *.pdf can it be done * way? all the *.txt in current directory? Thanks, On Thu, Sep 15, 2011 at 11:58 PM, lina lina.lastn...@gmail.com wrote: Hi, in some directory it has some files, let's say: a.txt

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread lina
On Fri, Sep 16, 2011 at 12:07 AM, Aaron Toponce aaron.topo...@gmail.comwrote: On Fri, Sep 16, 2011 at 12:03:40AM +0800, lina wrote: mv *.txt *.pdf can it be done * way? all the *.txt in current directory? Yes. Checkout the rename(1) command. It comes from Perl, and can be used for

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread Jochen Spieker
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

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread lina
On Fri, Sep 16, 2011 at 12:12 AM, Jochen Spieker m...@well-adjusted.dewrote: 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

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread Axel Freyn
On Thu, Sep 15, 2011 at 10:07:16AM -0600, Aaron Toponce wrote: On Fri, Sep 16, 2011 at 12:03:40AM +0800, lina wrote: mv *.txt *.pdf can it be done * way? all the *.txt in current directory? Yes. Checkout the rename(1) command. It comes from Perl, and can be used for exactly that.

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread lina
On Fri, Sep 16, 2011 at 12:16 AM, Aaron Toponce aaron.topo...@gmail.comwrote: On Thu, Sep 15, 2011 at 10:07:16AM -0600, Aaron Toponce wrote: On Fri, Sep 16, 2011 at 12:03:40AM +0800, lina wrote: mv *.txt *.pdf can it be done * way? all the *.txt in current directory? Yes.

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread lina
On Fri, Sep 16, 2011 at 12:27 AM, Axel Freyn axel-fr...@gmx.de wrote: On Thu, Sep 15, 2011 at 10:07:16AM -0600, Aaron Toponce wrote: On Fri, Sep 16, 2011 at 12:03:40AM +0800, lina wrote: mv *.txt *.pdf can it be done * way? all the *.txt in current directory? Yes. Checkout

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread Axel Freyn
On Fri, Sep 16, 2011 at 12:47:11AM +0800, lina wrote: You have options. Just some additional remarks: a) the for-loop won't work, as FILE is expanded to the name including the .txt, so if you have a file a.txt this loop will execute mv a.txt.txt a.txt.pdf You need

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread Ivan Shmakov
Jochen Spieker m...@well-adjusted.de writes: 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

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread Ivan Shmakov
Axel Freyn axel-fr...@gmx.de writes: […] So you should try e.g. for FILE in *.txt; do mv $FILE `basename \$FILE\ .txt`.pdf; done Backticks are obsolete for a long time, and that's precisely the reason. Consider how much cleaner is the following: for FILE in *.txt; do

Re: A quick Q: how do I command something in large amount

2011-09-15 Thread Jochen Spieker
lina: On Fri, Sep 16, 2011 at 12:12 AM, Jochen Spieker m...@well-adjusted.dewrote: but the situation is a bit different, here we have .txt file and also .log files and only .txt files are expected to convert, It would help if you didn't change the specifications. :) Nevertheless, you can