I have the data as below:


I need to get the 2nd field only


Tried multiple tricks with awk command, but unable to find it out. Can someone please help.

1 Answer 1


Since the separator contains more than one character and all of them are special (both ^ and | are regular expression operators), you need to escape them. On the command line, you would do this with

awk -F '\\^\\|\\^' '{ print $2 }' file

You need the double backslashes to escape the backslashes themselves too (for a different reason).

  • Thank you ! Great Help !
    – PriB
    Dec 26, 2019 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .