[lug] Scripting help, lynx

Paul Nowosielski paulnowosielski at yahoo.com
Tue May 3 08:23:53 MDT 2011


This worked rather well:


for file in `find ./ -name *.html`
do
     lynx -nolist -dump $file > $file.txt
     rm -f $file
done

find  ./ -name '*.html.txt' | while read file ; do mv $file
${file%.html.txt}.txt ; done




On 5/3/11 6:58 AM, Paul Nowosielski wrote:
> Dear All,
> 
> I'm trying to convert all the html files
> into text using lynx. The files are in many directories
> with meaningful names.
> 
> Can anyone assist me in creating a script
> That will go through each directory recursively
> and convert the files to text and preserve the base name.
> 
> ex: file1.html file1.txt file2.html file2.txt (or something close to this)
> 
> I have this so far, which correctly traverse the directories
> and spits out the text. But I am not understanding out how
> to direct to a txt file with the same name as the html file.
> 
> find ./ -name *.html |xargs -I '{}' lynx -nolist -dump '{}'
> 
> Any thoughts?
> 
> Thank you,
> 
> Paul
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety




More information about the LUG mailing list