Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Using "cut" for field "N" thru the "last" field

SOLVED
Go to solution
john guardian
Super Advisor

Using "cut" for field "N" thru the "last" field

Isn't there a method for using cut to grab, for instance, the 3rd thru the "remaining" fields in a space delimited string.

String example: ExStr="One 2 three for"

Let's say I want "all fields beyond field 2 (3-end of the string). Doesn't cut work with some limited set of wildcards for this...

IE: echo $ExStr | cut -f 3- -d " "

3 REPLIES
Highlighted
larsoncu
Advisor
Solution

Re: Using "cut" for field "N" thru the "last" field

3- would specify 3 thru the last
Sandman!
Honored Contributor

Re: Using "cut" for field "N" thru the "last" field

# echo "one two three four five six seven eight nine" | cut -f3- -d" "
john guardian
Super Advisor

Re: Using "cut" for field "N" thru the "last" field

Thanks.