Commands tagged html2text (5)

  • Translate strings from non-german to german (and vice versa) using LEO. Put it in your ~/.bashrc. Usage: leo words   To use another language other than english, use an option: leo -xx words Valid language options: ch - chinese en - english es - spanish fr - french it - italian pl - polish pt - portuguese ru - russian The other language will always be german! Show Sample Output


    4
    leo (){ l="en"; if [ "${1:0:1}" = "-" ]; then l=${1:1:2};shift;fi;Q="$*";curl -s "https://dict.leo.org/${l}de/?search=${Q// /%20}" | html2text | sed -e '0,/H.ufigste .*/d;/Weitere Aktionen/,$d;/f.r Sie .*:/,$d' | grep -aEA900 '^\*{5} .*$'; }
    michelsberg · 2013-06-24 22:35:46 29
  • required packages: curl, xml2, html2text command is truncated, see 'sample output' Show Sample Output


    3
    open R,"curl -s http://feeds2.feedburner.com/Command-line-fu|xml2|"; while(<R>){ chomp; m(^/rss/channel/item/title=) and do{ s/^.*?=//; ($t,$d,$l)=($_,undef,undef) }; m(^/rss/channel/item/description=) and do{ s/^.*?=//; push @d,$_ }; m(^/rss/channel/item
    bandie91 · 2012-02-24 23:40:02 5
  • Tries to avoid the fragile nature of scrapers by looking for user-input in the output as opposed to markup or headers on the web site. Show Sample Output


    0
    function ip-where { wget -qO- -U Mozilla http://www.ip-adress.com/ip_tracer/$1 | html2text -nobs -style pretty | sed -n /^$1/,/^$/p;}
    tox2ik · 2012-10-22 21:39:53 5
  • 1. There is no use of '--color=auto' in front of a pipe--instead with '--color=always' grep will mark the section headings. 2. I suppose the use of grep with '-A 900' or '-B 900' respectively a 'dirty trick'--sed can do 'exactly' what we want, however, grep does the nice colouring (see 1.) 3. Cutting of the tail (everthing starting with 'Weitere Aktionen') first leads to no output if leo doesn't no the translation. Show Sample Output


    0
    leo () { lang=en; IFS=+; Q="${*// /%20}"; curl -s "https://dict.leo.org/${lang}de/?search=${Q//+/%20}" | html2text | sed -e '/Weitere Aktionen/,$d' | grep --color=auto --color=always -EA 900 '^\*{5} .*$' }
    jandclilover · 2015-01-09 13:58:36 8
  • Check out Gate number for your flight from CLI with Chrome, html2texgt and grep. Works on Arch Linux (Garuda) and probably will work on others. Requirements: * google chrome (might work with chromium as well) * installed html2text (on archlinux: sudo pacman -S python-html2text) * installed grep (comes by default with your OS) * the gate number should be visible at the given website (it's not existent too early before the flight and also disappears after the flight departed) Please don't forget to replace the link to appropriate one, matching your flight. You can also wrap this into something like `whlie true; do ...; sleep 60; done' and this will check and tell you the gate number maximum in 1 minute after it appears on Avinor website. Show Sample Output


    0
    google-chrome-stable --headless --dump-dom --disable-gpu "https://avinor.no/flight/?flightLegId=dy754-osl-trd-20220726&airport=OSL" 2>/dev/null | html2text | grep -A2 Gate
    sxiii · 2022-07-26 11:50:59 401

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Delete a file/directory walking subdirectories (bash4 or zsh)

Reset hosed terminal,
stty sane resets the tty to basic usable function. The ^J is a newline -- sometimes CR/LF interpretation is broken so use the ^J explicitly.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Convert embedded spaces in filenames to "_" (underscore)
This command converts filenames with embedded spaces in the current directory replacing spaces with the underscore ("_") character.

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Check if a machine is online with better UI
I have used single packet, and in a silent mode with no display of ping stats. This is with color and UI improvement to the http://www.commandlinefu.com/commands/view/10220/check-if-a-machine-is-online. It is as per the enhancements suggested.

Determining the excat memory usages by certain PID
this command gives you the total number of memory usuage and open files by the perticuler PID.

list files recursively by size

add all files not under version control to repository
With the force options the same results can be achieved


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: