Awk Text Split and Delimit Examples

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/awk-text-split-delimit-examples/
PINTEREST
PINTEREST
INSTAGRAM

Awk provides a lot of functions to manipulate, change, split etc. We will look how to split text with awk with different examples. For a general awk tutorial please look following tutorial.

Awk Print Tutorial With Examples

Split Syntax

Awk provides the split function in order to create array according to given delimiter. split function syntax is like below.

  • SOURCE is the text we will parse
  • DESTINATION is the variable where parsed values will be put
  • DELIMITER is the sign which will delimit

Default Delimiter – Space

The delimiter is optional. So there is a default delimiter which is space. If we do not provide any delimiter space will be used as delimiter. In this example we parse 12 13 14 .

Default Delimiter

Default Delimiter

Provide Separator

Now we generally need to provide different delimiters. We can provide delimiter as third parameter. In this example we will specify the : as delimiter.

Provide Separator

Provide Separator

Use Comma As Separator

In this example we will use comma as delimiter.

Use Comma As Separator

Use Comma As Separator

Use Pipe As Separator

In this example we will use pipe as delimiter.

LEARN MORE  Linux Print History Command Without Line Numbers

Use Pipe As Separator

Use Pipe As Separator

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/awk-text-split-delimit-examples/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)