Re: Using "cut" for field "N" thru the "last" field (138 Views)
Reply
Super Advisor
john guardian
Posts: 309
Registered: ‎09-26-2003
Message 1 of 4 (138 Views)
Accepted Solution

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 " "

Advisor
larsoncu
Posts: 18
Registered: ‎08-02-2007
Message 2 of 4 (138 Views)

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

3- would specify 3 thru the last
Honored Contributor
Sandman!
Posts: 2,220
Registered: ‎01-13-2005
Message 3 of 4 (138 Views)

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

# echo "one two three four five six seven eight nine" | cut -f3- -d" "
Super Advisor
john guardian
Posts: 309
Registered: ‎09-26-2003
Message 4 of 4 (138 Views)

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

Thanks.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.