Current location - Loan Platform Complete Network - Big data management - awk how to intercept the penultimate line of data
awk how to intercept the penultimate line of data

1, first of all, to check whether AWK is already installed, in general this is the system built-in commands, direct a TAB key to see if you can fill in.

2, rpm query, through rpm -qa|grep awk check.

3. If awk is not installed, install it via yum or apt.

4. Check help via awk --help to see how to use awk.

5, awk get the last two lines of the file, awk '{print}' /etc/passwd |tail -n 2.

6, get the last line of the file? awk 'END{print}' /etc/passwd.

7. Actually, it's too much trouble to get it via awk, just use tail -n directly.