Unix cut, remove first token
I'm trying to use Unix cut to remove the first two fields per line. I have input lines of of the form开发者_如何学运维
(token)(whitespace)(token)(lots of text)
The problem is that there exit n
tokens per line, so I can't do something like this
cut -f3,4,5,6,7,8,9
Is there a way to tell cut to take everything except
the specified fields?
cut -d' ' -f3-
-d' ' might be required.
cut -f3-
[Body is too short? Is that new?]
I tried the answer cut -d' '-f3-
but it did not exclude the field. The below command worked though. I am using Linux SLES.
cut -d' ' -f3 --complement
Reference link https://www.commandlinefu.com/commands/view/6867/exclude-a-column-with-cut
Happy to be corrected and learn. Thank you.
You can also use AWK for this:
awk '{$1=$2=""}1' file
精彩评论