bash command to convert html page to a text file

前端 未结 10 1185
醉梦人生
醉梦人生 2020-12-09 07:38

I am a beginner to linux. Would you please help me how to convert an html page to a text file. the text file will remove any images and links from the webpage. I want to use

10条回答
  •  情话喂你
    2020-12-09 08:32

    batch mode for local htm & html file, lynx required

    #!/bin/sh
    # h2t, convert all htm and html files of a directory to text 
    
    for file in `ls *.htm`
    do
    new=`basename $file htm`
    lynx -dump $file > ${new}txt 
    done
    #####
    for file in `ls *.html`
    do
    new=`basename $file html`
    lynx -dump $file > ${new}txt 
    done
    

提交回复
热议问题