Usage of unix tools Find,Sed and awk
Sed, Awk and Find are the excellent unix tools.Following are few problem statements where use of these tools made the work easy.Have a glimpse if these are useful to you as well. Dump only CPU usage and process of the server to a file. Top –n 1 –d | sed ‘1,6d’ | awk ‘{print $8 $NF }’ > dump.txt Find a pattern “EMC2” which exists in multiple files under current directory and replace the pattern with “CISCO” in all the files. Find . –type f | xargs sed –i ‘s/EMC2/CISCO/g’ OR find . –type f -exec sed –i ‘s/EMC2/CISCO/g’ {} \; Calculate the number of lines between a line containing pattern “XYZ” & a line containing pattern “ABC” in a file. Sed –n ‘/XYZ/,/ABC/p’ | wc –l List the top 3 largest files in a sub-directory. fi...