Saturday, 9 September 2017

How To Create Examples Of AWK

How To Create Examples Of AWK

code for AWK , example of AWK, code , How to Create AWK , code language , Website code.
This chapter describes several useful AWK commands and their appropriate examples. Consider a text file marks.txt to be processed with the following content −
 
1) Amit     Physics   80
2) Rahul Maths 90
3) Shyam Biology 87
4) Kedar English 85
5) Hari History 89

Printing Column or Field


You can instruct AWK to print only certain columns from the input field. The following example demonstrates this −
Example :

[jerry]$ awk '{print $3 "\t" $4}' marks.txt

On executing this code, you get the following result
Output

Physics   80
Maths 90
Biology 87
English 85
History 89

Post a Comment

Whatsapp Button works on Mobile Device only

Start typing and press Enter to search