First page Back Continue Last page Overview Graphics
Example 3-4: awk command
internal variables
We can reduce the complex awk command in previous slide to a simpler form using internal variable inside awk. We can introduce a variable called mag to store the value of substr($0,76,3)as magnitude of an event and refer to this variable instead.
awk ' { mag=substr($0,76,3); if (mag > 3 && mag < 4 && substr($0,55,1) != "F") print substr($0,26,17),mag}' earthquake_catalog.dat