You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Bash</strong> <strong>Guide</strong> for <strong>Beginners</strong><br />
The table below gives an overview of special formatting characters:<br />
Table 6-1. Formatting characters for gawk<br />
Sequence Meaning<br />
\a Bell character<br />
\n Newline character<br />
\t Tab<br />
Quotes, dollar signs and other meta-characters should be escaped with a backslash.<br />
6.2.3. The print command and regular expressions<br />
A regular expression can be used as a pattern by enclosing it in slashes. The regular expression is then tested<br />
against the entire text of each record. The syntax is as follows:<br />
awk 'EXPRESSION { PROGRAM }' file(s)<br />
The following example displays only local disk device information, networked file systems are not shown:<br />
kelly is in ~> df -h | awk '/dev\/hd/ { print $6 "\t: " $5 }'<br />
/ : 46%<br />
/boot : 10%<br />
/opt : 84%<br />
/usr : 97%<br />
/var : 73%<br />
/.vol1 : 8%<br />
kelly is in ~><br />
Slashes need to be escaped, because they have a special meaning to the awk program.<br />
Below another example where we search the /etc directory for files ending in ".conf" and starting with<br />
either "a" or "x", using extended regular expressions:<br />
kelly is in /etc> ls -l | awk '/\