The sed way:
sed -E ' s/^(([ \t]*-?[ \t]*[0-9.]+[ \t]+[0-9.]+)*)[ \t]+-?[ \t]*[0-9.]+$/\1/; s/[0-9.]+[ \t]+([0-9.]+)/\1/g' Output:
-2 4 -9 3 -5 -11 The first expression kills the trailing column if there are an odd number of columns. It does that by looking for 0 or more pairs <number> <number>, where the first number can be negative.
Edit: A shorter sed solution, inspired by @mikeserv:
sed -E ' s/[0-9.]+[ \t]*([0-9.]*)/\1/g; s/[- \t]*$//' The same thing with perl:
perl -lpe 's/^((\s*-?\s*[\d.]+\s*[\d.]+)*)\s+-?\s*[\d.]+$/$1/o; s/[\d.]+\s+([\d.]+)/$1/g' Another way with perl (probably the cleanest one):
perl -lpe '$a = 1; s/([\d.]+\s*)/$a++ % 2 ? "" : $1/eg; s/\s*[-\s*$\s]*$//o'