How to print from conmand line in bash

Viewed 32

How to print from command line starting at X position? For example if we say print from 5th position and the command line is:

One two three four five six

It should display:

five six 

(PLEASE NOTE: that I do not want it to have new lines in between meaning the output I desire is five six, and not five Six Each in new line) Thank you !

1 Answers

Parameter expansion is an appropriate tool for this job:

$ set -- one two three four five six
$ echo "${@:5}"
five six
Related