What are the command-line options and sample usages?
-d: specifies the delimiter to use -f: specifies the list of fields -s: do not print lines not containing delimiters -c: specifies columns to display (each character is one column)
cat access_log | cut -d' ' -f6 | grep '200' | wc -l
The -d' ' option tells cut to use space as the delimiter instead of the default tab character. And the -f6 option tells cut to grab field number 6.
my $appWriteDB = `grep 'appWriteDB' /etc/mg/setup.conf | cut -f2-3 -d ':'`;
The above sample extracts field 2 and 3. The data for the above sample:
cut -f1,3 -d" " file1 file2 // cut column 1 and 3 from file1 and file2 using " " delimiter paste file1 file2 // join file1 and file2 paste -d " " file1 file2 file3 // join files and put a space in between paste -s [-d] file1 file2 // merge consecutive line together. The number of lines to // merge together is given in the -d option