+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ AWK AWK stands for "Aho, Weinberger, and Kernighan". It is named after its creators Alfred Aho, Peter Weinberger, and Brian Kernighan, who developed the language while working at Bell Labs in the 1970s. replace a word with another word awk '{gsub(/sreejith/, "Balakrishnan"); print}' filename // This will replace all the sreejith to Balakrishnan Print a particular word if that appears in the file awk '{for(i=1;i<=NF;i++) if ($i == "word") print $0}' filename Print only once if a word was found in the file awk '{for (i=1; i<=NF; i++) if ($i == "sreejith" && !seen[$i]++) print $i}' test-file.txt Print the last word that has "america" as its last word awk '$NF ~ /america$/' test-file.txt or awk '$NF ~ /america$/{print $0}' test-...
Comments
Post a Comment