Handy One-Liners

Aus RZ-Amper Wiki
Zur Navigation springen Zur Suche springen

Stripp of HTML Tags

 sed -e 's#<[^>]*>##g'

Extract Page Title

 wget www.web.de -q -O - | grep -i "<title>" | /usr/local/bin/sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q

Find String in Files

 find ./ -type f -exec grep -l searchstring {} \;

Using Rsync

 rsync -av -e ssh source user@target:dest

Using Rsync on LAN

 rsync -avW -e ssh source user@target:dest

AWK, pint first row

 tail -1000 file.log | grep -i "irgendwas" | awk -F"Delimeter" '{print $1, $2}'

Grep for "schreischachtl" in apache access log file, grep for "POST", get ip address and count wich ip address accessed how often.

 grep "schreischachtl" access_log | grep "POST" | awk -F"-" '{print $1}' | uniq -c

Create bootable USB flash drive

 sudo dd bs=4M if=path/to/input.iso of=/dev/sd<?> conv=fdatasync  status=progress