Skip to main content

Posts

Showing posts with the label Scripts

AWK one liners [part three]

contd. sample files used for this tutorial. 1. Filteration of Row data awk   ‘$3 == $4 {print $1 “     “ $3}’ abc.txt awk -F “,” ‘$3 == $4 {print $1 “     “ $3}’ abc.csv Here before printing the required rows we can filter it out using   Some conditions. 2. Filteration of Row data with logical OR  awk -F "," '$3 == 10000 || $4 == 10000 {print $1 "     " $2}' abc2.csv 3.  Filteration of Row data with logical AND awk -F "," '$3 == 10000 && $4 == 10000 {print $1 "    " $2}' abc2.csv

AWK one liners [part one]

AWK was initially developed in 1977 by Alfred Aho , Peter J Wienberger  and Brian Kernighan. And hence the name(AWK) derived from  their respective initials. AWK was designed basically for text processing and used mostly for  extraction  a nd manipulation of data. For more info  :  visit here Lets start with the examples. 1. Print Specific Column from a file sample file created awk '{print $1 "   " $3}' abc.txt awk '{print $1 "   " $3}' abc.txt 2. Print all data from a table awk '{print $0}' abc.txt