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.


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 '19 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.