Awk Multiple Delimiters

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Awk Multiple Delimiters

Sudarshan
Any idea on how to parse |+ as delimiter. I have a file which looks like below

123|+MN|+2014
456|+DE|+2015

It is |+ separated file. But not able to process |+ as delimiter via awk...I want to parse and print third column i.e. which contains data points 2014 and 2015

any help would be really appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Awk Multiple Delimiters

Guru
Administrator
Like this:

$ awk -F "[|+]"+ '{print $3}' file
2014
2015

To understand about the delimiter, check the examples in this link, especially 7 and 9: awk - reading files with multiple delimiters.
Reply | Threaded
Open this post in threaded view
|

Re: Awk Multiple Delimiters

Sudarshan
Thanks buddy for your help.......It worked !!