Sometimes you need to get a specified column of a text but it’s really hard to choose a suitable column separator. For example we will get the second column from the following text file.
$ cat ./text.txt abc,def-ghi 123-456-789 qaz,wsx,edc qwe-asd,zxc
We can see two field separators: a comma and a minus sign. Fortunately awk can use regular expressions as field separator. In this case we use the following line.
$ awk -F"[-,]" '{print $2}' ./text.txt def 456 wsx asd