Last active
August 29, 2015 14:00
-
-
Save ShahriyarR/11215007 to your computer and use it in GitHub Desktop.
AWK usage
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
1. # Sadece Butun logfile-i oxuyur print edir. | |
awk '{print $0}' logfile.log --- print the entire line. | |
2. # Her setrden ilk column, field-i cixardir | |
awk '{print $1}' logfile.log | |
3. # Ilk olaraq 2ci field daha sonra 1ci field-i cixardir | |
awk '{print $2,$1}' logfile.log | |
4. # Regex-den istifade etmekle search | |
awk '/Inn/ {print $0}' logfile.log --- Inn sozu kecen sertleri cixardir | |
5. # 5ci columunda Inn sozu olan butun setrleri cixardir: | |
awk '{if ($5 ~ /Inn/)print $0}' logfile.log | |
6. # sonu 2011-le va yaxud ne ilese biten setri axtarmaq: | |
awk '/2011/ {print $0}' logfile.log | |
7. # Pipe to ps with awk and grep: | |
ps -ef | awk '{print $8}' | grep "chrome" | |
8. # Find range: | |
awk '{if ($2 ~ /[89]/) print $2, $3}' /var/log/messages | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment