Tuesday, November 11, 2014

Single liner to ping a subnet from command line

for ip in 192.168.10.{1,2,3..254};do ping -c 1 $ip;done

Tuesday, January 28, 2014

Shell - List number of lines once the search pattern matches

awk '/PATTERN/ {for(i=1; i<=5; i++) {getline; print}}' filename

The above command will search the key word "PATTERN" once it is matched, it will print the below 5 lines after the search string from the text file.