searching zip files.......
zcat portal-backend.log.2016-08-11.gz | grep zhu98156 -A 100
-B 50
zgrep 'zhu98156' portal-backend.log.*
GREP
grep -B 10 -A 10 feb67864 *
Grep with OR
grep -e 2015 -e 2014 -u5
#save output to a file
grep -B 10 -A 10 feb67864 * > nuwan.txt
#exclude files
grep berdell34145 * --exclude=*.gz
Print lines before and after
cat portal-backend.log | grep "ERROR" -A 5 -B 5
grep "ERROR" *.log -A 10 --color=always
save to file
grep -r serieslogos * > nuwan.txt
#save grep output to a file
Grep “transactionId” portal-backend.log > ~/nuwan1.txt
Tail
tail catalina.out //default last 10 lines
tail catalina.out -n
20 //last 20 lines
live update
tail -f *.log *.out | grep --color=always ERROR
-A10
add new line between lines
tail -f * | grep ERROR -A5 --color=always| sed G
tail -f /export/home/portal/logs/tomcat/8080/*.log | grep
--color=always ERROR -A 10
Clean a file
truncate portal-backend.log --size=0
LESS
G - end of file
Comments
Post a Comment