[lug] Scripting help, lynx

Dan Ferris dan at usrsbin.com
Tue May 3 07:04:47 MDT 2011


for $file in `ls *.html`
do
     lynx -nolist -dump > $file.txt
done

That will redirect the file to $file.html.txt, I'll leave it as an 
exercise for you to figure out how to change it to $file.txt.

Dan

  On 5/3/2011 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