In bash, I want to get the Nth word of a string.
For instance:
- STRING="one two three four"
- N=3
- Result: "three"
What bash command/script could do this?
Thank you!
In bash, I want to get the Nth word of a string.
For instance:
What bash command/script could do this?
Thank you!
An alternative
N=3
STRING="one two three four"
arr=($STRING)
echo ${arr[N-1]}