3. awk command examples for displaying all the records between Manmohan and Anshul
[root@kalwa1 tmp]# awk '$1 ~ /Manmohan/,/Anshul/{print $0}' students Manmohan 286 555-5574 manmohan 8 Atul 280 555-4221 atul 10 Anshul 279 555-1112 anshul 2 [root@kalwa1 tmp]#
4. awk command examples for not printing all records but only fields 2 and then 1 field:
[root@kalwa1 tmp]# awk '$1 ~ /Manmohan/,/Anshul/{print $2" " $1}' students 286 Manmohan 280 Atul 279 Anshul [root@kalwa1 tmp]#
5. awk command examples for printing the entire students database:
[root@kalwa1 tmp]# gawk {print} students Manmohan 286 555-5574 manmohan 8 Atul 280 555-4221 atul 10 Anshul 279 555-1112 anshul 2 Romel 284 555-2121 shrikant 12 [root@kalwa1 tmp]#
Leave a Reply