begin  quoting Todd Walton as of Sun, Jul 10, 2005 at 10:24:08PM -0700:
[snip]
> You must specify the name of the input file (duh), and the name of the
> output file that it will create.

You can't give it stdin and redirect stdout?

>                                   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

Why? I don't see any bash-specific stuff going on here. What's wrong
with sh?

> wvText $1 $1.txt

In tcsh, you use stuff like :t and :r to to that. So something like:

foreach i ( /dir/full/of/files/* )
   wvText $i ${i:t:r}.text
end

...does a fine job.

I'm sure there's a similiar construct in bash.  Of course, there's
always dirname and basename and friends...

wvText $1 `basename $1 .doc`.text

-Stewart "I bet zsh has a slick way of doing this as well" Stremler

Attachment: pgpOO788GeLDX.pgp
Description: PGP signature

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

Reply via email to