User Tools

Site Tools




count results with -c
grep -c "ESSID:" /tmp/wifiscan
grep, cut and tr

cut from char 27 and then remove double quotes with tr

iwlist wlan0 scan | grep ESSID  | cut -c 27- | tr -d '"'

ack is een alternatief voor grep

find string in files
find . | xargs grep 'string' -sl
find folders over 1GB
du -h / | grep ^[0-9.]*G
ps & grep

grep -x matches exact line

ps ax -o cmd | grep -x 'php crawler.php'
search for a phrase in all files:
grep something *
search for a phrase in all files (recursive):
find . | xargs grep -s phrase
get ip address
ifconfig en1 | grep "inet " | cut -d " " -f2
searching in files recursively
grep -ir "texttofind" *
using the find command on the command line
find . | grep -i ".cpp"
use grep to search output of a program
git diff | grep 'piano'
delete frozen mail messages in queue via exim
sudo exim -bpru|grep frozen|awk {'print $3'}|xargs sudo exim -Mrm
ls open files
lsof | grep -i 'tmp'
sed & cut
grep -o '\(T:\)\([0-9]*\.[0-9]*\)' /tmp/UltiFi/ttyACM0/ temp.out | cut -c 3-
grep.txt · Last modified: 2014/11/23 16:33 (external edit)