Todd Walton wrote:
> 
> You must specify the name of the input file (duh), and the name of the
> output file that it will create.  Well, I have a whole directory full
> of these doc files.  The problem is, wvText doesn't let you just give
> the name of the file to be converted and then intelligently name the
> output "input" plus ".txt".  That would make sense.  wvText requires
> you to specify a name for the output file.  How can I script this to
> do them all?  Maybe something like:
> 
> #!/bin/bash
> wvText $1 $1.txt
> 
> But something is wrong with that.  Perl would be interesting, too...

for i in *.doc; do wvText $i ${i%doc}.txt; done

If you used ${a/doc/txt} then you would suffer from adoc.doc ->
atxt.doc, not what you want. So we truncate the doc at the end, and
append a txt to turn adoc.doc -> adoc.txt.

The above snipped is bash and zsh friendly. sh will choke on it.

-john


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to