 vote
 |
|
I really love writing about programming and Linux, and I just published my first e-book ever on Awk one-liners.
Awk one-liners are short Awk programs that fit on one line and do one particular task, such as numbering lines, double spacing lines, printing only lines that match a pattern, etc.
Here is an example. The following one-liner prints all users on the Linux system:
awk -F: '{ print $1 }' /etc/passwd
This one-liner works this way. The -F: command line argument specifies that the lines in the /etc/passwd file should be split into fields by the colon character. As we all know, the information in /etc/passwd file is colon separated, so the first field $1 gets set to the username, the second field $2 gets set to the password, the third field $3 gets set to user id, etc. This one-liner prints only the first field which is the username. Simple, isn't it?
In my 50 page long e-book I carefully explain 70 one-liners in similar way.
Here is the table of contents of the e-book:
Preface. 1. Introduction to Awk One-Liners. 2. Line Spacing. 3. Numbering and Calculations. 4. Text Conversion and Substitution. 5. Selective Printing and Deleting of Certain Lines. 6. String and Array Creation. Appendix A: Awk Special Variables. Appendix B: Idiomatic Awk. Index.
| | |
| |
|
|