First page Back Continue Last page Overview Graphics
Example 3-4: awk command
if and awk
Often we need to extract a subset of information based on the contents of information presented on different rows in a data file. For example if we want to extract lat and long and magnitude of events in file earthquake_catalog.dat having magnitude larger than 3, we should use if in awk command as follow,
awk '{if (substr($0,76,3) > 3) print substr($0,26,17),substr($0,76,3)}' earthquake_catalog.dat |more