Shell Data Processing - Awk (grep and sed) - Output filtering

About

The awk command is a filter that combines the functions of:

AWK is a (tool|language) for event-based data processing.

Management

Function

Example

ls

Linux - ls (List directory content) with only acl information.

ls -l | grep pls.txt |  awk '{print $1, $2, $3, $4}'
-rw-rw---- 1 oracle oinstall

To get the cached memory

With the free command:

[[email protected] ~]$ free | grep Mem | awk '{print $7}'
137329856
[[email protected] ~]$ free
             total       used       free     shared    buffers     cached
Mem:    1058964444 1011201796   47762648          0    1272644  137329872
-/+ buffers/cache:  872599280  186365164
Swap:    101023736       4392  101019344

Escape

Example on how to escape the :

awk '{print $1"\:"$2}'

Documentation / Reference


Powered by ComboStrap