Learning Linux Lesson 30 Using AWK and split to extract data
More videos like this online at www.theurbanpenguin.com
One of the real powerfull elements of AWK is its own in-built functions and today we will look at using the split function with AWK. The syntax for aplit is litited as the following:
split(string,array,[separator]) In simple term split creates an array from a text string, the elements of the array are delimited by the optional separator. If no separator is supplied a space is assumed. In my example I will work with email addresses to extract the domain name john.doe@example.com fed into split(«john.doe@example.com»,DNS,"@") would give:
DNS[1]=john.doe and
DNS[2]=example.com
Se how we then build this into awk to pass data from text files.
0 комментариев