We have already seen most of these concepts already and even wc itself in one of the previous recipes, so let's get started:
- Open a terminal and run the following commands:
$ wc -l testdata/duplicates.txt$ wc -c testdata/duplicates.txt
- As you may have noticed, the output has the filename included. Can we remove it with AWK? Absolutely, but we can also remove it with a command called cut. The -d flag stand, for delimiter and we would like to have a field (specified by -f1):
$ wc -c testdata/duplicates.txt | cut -d ' ' -f1$ wc -c testdata/duplicates.txt | awk '{ print $1 }'
- Imagine that we have a massive file full of strings. Could we reduce the returned results? Of course, but let's use the sort command first to sort the ...