To work with structured text cells efficiently, it can be useful to filter
out specific columns, because many text cells on Linux are organized in columns.
The ETCPass WD file is a nice example. It contains users that are defined on your
system, and cut is an easy to use command that filters out columns from text files.
To do its work properly, you need to specify the field delimiter for cut. That would be the option D.
To understand, compare the result of the command cut f3etcpass wd,
which is trying to filter the third field without specifying the
field delimiter and Compare that to cut D F3 etcpasswd.
You'll see that it is much more efficient.
A utility that you will find a lot in combination with cut is Sort.
Because it sorts the output of the cut command by default in alphabetical order.
You can use the n option to sort in numeric order.
Compare the following, for instance cut d, f3 etc
wdsort and sort n. Let me show you.
So to start with good minus
f3 etcwd is doing what?
Well, nothing that makes sense because cud doesn't know how to recognize the fields.
What we see here, if you look at the last line for user lorry, for instance, first field has the
username, the third field has the user id, and there is more information that we will talk about later.
Now, if I want to tell cut to do this in an efficient way, let's make
that cut d colon there. You can see that it filters out the third column.
Now we can sort that by sending it to sort. But this is an alphabetic sort,
so all ones first, all twos next, all 3s next, and so on. That's not probably
what you want. So make that sort n to make it a nice numeric sort.
And that's how you can use sort and cut, which are two convenient utilities together.