Linux ‘a flavor’ – “cut” command
Hello dear reader,
If you want to extract data from a file, “cut” is probably the first command that comes to mind. Manual page for the command can be displayed by using “man cut”. I will not review all of the options but the delimiter usage with -s option.
The sample file is shown as below.
Lets extract first field by choosing * as delimiter. The command
If you execute the command shown above, the output contains the lines that we do not want to extract.The output should have displayed only second line as the delimiter character has only been in the second line. At this point, -s option should be used when executing the “cut” command to suppress lines with no field delimiter char.
If we look at the example above, command outputs contains only the lines in regarding to the delimiter we have chosen.
You can review lots of example by googling “cut delimiter usage” 🙂
Have a nice day.