perl -lane 's/[)(]//g for @F; print"@F[0,2..$#F-2,$#F]" unless /^\d/' input