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 writes: > > On Fri, 16 Sep 2011 00:17:47 +0700, Ivan wrote: > >

[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 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

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 > t

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 wrote: > > 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 just use "for f in

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

2011-09-15 Thread Ivan Shmakov
> Axel Freyn 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 mv "$

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

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

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 > >

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 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. Check

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 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. Che

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 ex

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 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 '*'

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

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 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 th

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 wrote: > Hi, > > in some directory it has some files, let's say: > > a.txt b.txt c.txt d.txt >