Linux is awesome v1

In part 1 of a (potentially) recurring series of posts on the subject, I learned the use of Linux’s awk command, that can be used to parse a text file and return textual tokens that occur after a specified input token.

The command is used as follows:

> cat textfile | awk -F “<input token text> ” ‘{print $2}’

Cat the textfile so its contents are scanned through. Then the awk command is given the <input token text>, such that it locates the token in each line of the file and tokenizes the remainder of the line. The part of the line preceding the token can be printed by {print $1} and the part after the token by {print $2}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s