For example, the
cut command can take a parameter -f, which according to
select only these fields; also print any line that contains no delimiter character, unless the -s option is specified
In this context, what is a field?
The term "field" is often times associated with tools such as
However as is the case with most tools, it's configurable. For example:
This first one shows how
This one shows how
Here we have a CSV list of column data that we're using
Awk too can do this:
Awk is also a little more adept at dealing with a variety of separation characters. Here it's dealing with Tabs along with Spaces where they're inter-mixed at the same time:
What about the -s switch to cut?
With respect to this switch, it's simply telling
Say we had this file.
NOTE: There are spaces and tabs in the 2nd string above.
Now when we process these strings using
In the 2nd example you can see that the
A field according to POSIX is any part of a line delimited by any of the characters in
The term "field" is not related to linux in general, but to specific programs. So
If your data is separated by colons in the lines, you can combine
It depends on the utility in question, but for
Unless you specify a field delimiter with the "-d" option:
Other utilities have different definitions, but a tab-character is common.
The moral of the story is to be careful, and experiment if you don't know.
I agree with earlier posters that fields/keys in