Site Loader
111 Rock Street, San Francisco

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.

Screen Shot 2016-05-07 at 15.40.16

Lets extract first field by choosing * as delimiter. The command

Screen Shot 2016-05-07 at 15.45.39

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.

Screen Shot 2016-05-07 at 15.58.49

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.



Post Author:

Leave a Reply

Your email address will not be published. Required fields are marked *