Reputation: 956
I have a file which contains rows like this
name[^legalName[^code[^type[^contactNumber1[^contactNumber2
I want to extract column two from this file. I don't find any problem when I have a single character delimiter. But how do I extract when there is a multiple character delimiter.
Upvotes: 2
Views: 103
Reputation: 75565
awk
interprets the field separator as a regular expression, so you just need to double \\
escape each character to get the literals.
echo 'name[^legalName[^code[^type[^contactNumber1[^contactNumber2' | awk -F'\\[\\^' '{print $2}'
legalName
Upvotes: 2