#!/usr/local/bin/perl -nw chomp; while (/( [A-Za-z]+ # words | [0-9]+ # numbers | 's | -- # some special symbols | [^ ] # individual symbols )/gx) { print "$1 "; } print "\n";