Created
October 4, 2016 14:01
-
-
Save PankajWorks/b8b0c3f596cb8f399f309944603078e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'this is a test' | awk '{print $NF}' #print last column | |
awk '{print $1, $(NF-2) }' access_log | |
awk '{print NR ") " $1 " -> " $(NF-2)}' access_log #NR prints the row number | |
awk '{print $2}' access_log | awk 'BEGIN{FS=":"}{print $1}' #splits along ':' | |
awk '{print $2}' logs.txt | awk 'BEGIN{FS=":"}{print $1}' | sed 's/\[//' | |
awk '{if ($(NF-2) == "200") {print $0}}' # conditional | |
awk '{a+=$(NF-2)}END{print "Total:", a}' logs.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment