I need to extract substrings from a file into a new file. Mac or Linux.
The data is between the 4th and 5th "|" symbol.
HD|262339|9400530374||K7UKD|A|HA|12/15/2009|03/13/2020
The actual columnar position varies, sometimes by a lot, but the data is always between the 4th and 5th pipe symbol.
Sample data is as above, expected output would be K7UKD
.
I've tried various hacks at a regex:
grep "/\|(\w+)\|/" input.txt > output.txt