austin
austin

Reputation: 45

Unix AWK command - multiple character as a single delimiter

I am trying to use two data pipeline, || , as delimiter in AWK command. But I am unable to do it. I have a file in which I have to consider two data pipeline as delimiter, just like considering TAB or COMMA as delimiter.

Upvotes: 0

Views: 328

Answers (1)

Derlin
Derlin

Reputation: 9891

Just tell awk to interpret the | literally with []:

awk -F'[|][|]' ...

Example:

» echo "1 || 2" | awk -F'[|][|]' '{ print $2 }'
2

Upvotes: 2

Related Questions