Friday, 19 October 2012

Finding nth occurance of the particular word

sam@sam-Lenovo-G450:~$ cat sam | gawk '{if($2==2) {x++; if(x==6) {print $0}}}'
drwxr-xr-x  2 sam sam     4096 2012-09-27 22:53 Documents

No comments:

Post a Comment