You were almost there. This works:
$ perl -wE 'while (<>) {if (m{ \A \S+ \s+ \S+ \s+ Homo \s+ sapiens .*? + ([NX] \S+) \s+ \S+ \s+ \z }msx) {say $1}}' < 867580.dat NP_001120800.1425 NP_000009.1655 NP_000023.2587
There's some whitespace at the end of the lines so your final \S+$ wasn't matching.
-- Ken
In reply to Re: Regex / "Sophisticated" End of Line
by kcott
in thread Regex / "Sophisticated" End of Line
by nofutur45
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |