Friday, 24 March 2017

awk practice

$ cat /home/sfertile/bin/capture_dot
#!/bin/bash

grep Writing | awk -F\' '{print $2}'



This script grep the lines that contains "Writing" and then split the lines into different columns using the ' symbol seperator, and print the second element after splitting. 

It is equivalent to :
grep Writing | awk -F "'"  '{print $2}'

if we ignore, -F, the default separator will be space.

No comments:

Post a Comment