Description
Assume that adjacent fields are separated by ONE or MORE spaces.
|
CASE 1
Delete FIRST THREE fields.
|
| Raw Input
|
| Desired Output
| aa bb cc dd ee ff gg hh
|
| dd ee ff gg hh
|
|
Script and Comments
Script1 [sed] [ 1] s/^ *\([^ ]* *\)\{3\}//
|
Script2 [perl] [ 1] s/^ *([^ ]* *){3}//;
| |
CASE 2
Delete the LAST THREE fields.
|
Script and Comments
Script1 [sed] [ 1] s/ *\([^ ]* *\)\{3\}$//
| |
| Raw Input
|
| Desired Output
| aa bb cc dd ee ff gg hh
|
| aa bb cc dd ee
|
|
Script and Comments
Script1 [perl] [ 1] s/ *([^ ]* *){3}$//;
| |