- or download this
[~] $ perl -wnle'/^((?:\S+\s+){1,30})/;print $1'
one two three four five six seven
one two three four five six
- or download this
[~] $ perl -wnle'/^((?:\S+\s*){1,30})/;print $1'
one two three four five six seven
one two three four five six seven
- or download this
[~] $ perl -wnle'@w=split/\s+/,$_,31;pop@w;print join " ",@w'
one two three four five
one two three four