the 'awk' command.
I have enrolled in a Linux Certification course and damn this particular book for not being more specific about commands than to give the jist. I wondered if someone might tell me what a "delimiter" is when used in reference to the 'awk' command. An example of usage is:
ls filename | awk -->-F:<-- '/and/{print $2,$6,$9} where the -F argument is used to change the delimiter from the default, tabs and spaces, to the configuration common delimiter of colon, :. Also, I wondered, because the book is unclear in its explanation of the 'awk' command if the ' is an argument to say "search" or what exactly does the apostrophe denote to this command? An example usage is: ls filename | awk -->'<--/and/{$1} In either example the arrows point to the appropriate argument/modifier. Thankyou. IconicMoronic |
A delimiter is what defines the fields - in other words, what $2, $6 and $9 are are defined as what the delimiter is *not*. So
foo<space>bar<tab>baz means $1 is 'foo' and $2 is 'bar<tab>baz' if the delimiter is just a space and 'foo<space>bar' and 'baz' if the delimiter is just a tab. As far as the single quote, there should be a final quote as well and it just protects the awk 'program' from being interpreted by the shell. The 'search' part of it is the '/and/' part, which says to apply the '{}' rule to records matching that expression. Might try checking out the info manual for gawk, which is a form of a published book on the subject. |
thankyou
thanks so much. i'll check it out. i should've thought harder, i might've recalled the bit about protecting from shell interpretation. thanks again.
iconicmoronic |
All times are GMT -5. The time now is 11:43 PM. |