B"H
On 7/10/05, Todd Walton <[EMAIL PROTECTED]> wrote:
> I have a scripting question.  I have files that are in one format,
> .doc, and I want to convert them to another format, .txt.  I have a
> program called wvText that works like this:
> 
> wvText somefile.doc somefile.txt
> 
> 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?

Here is a very basic bash script that is intended to run from the
directory that has the files to be converted:

#!/bin/bash

for i in `ls *.doc`
do
        #use cut to split $i into 2 fields, one before the dot and one after.
        #take the first part (all except the extension) and use it as
a base for the txt file
        BASE=`echo $i |cut -f1 -d.`
        wvText $i ${BASE}.txt
done

Menachem

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


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

Reply via email to