in reply to regular expression help

This should do the job:
my @results; while (<>) { if (/^N\d+\s+\*(.*)/) { push @results, "!$1"; } else { push @results, /[XYZ]([-+]*[\d\.]+)/g; } } print join ' ',@results;
The first regex handles comment lines, the second one greps all occurances of either an X,Y or Z followed optionally by a negative or positive sign followed by a combination of digits and dot.

If there is only one comment line on the top of each file, you could do this faster, but for a couple of thousand lines it should not matter.

update: the code was wrong, I forgot the * after the sign match.

---- amphiplex