How can i cut first word from a string, and then result store to variable?
So in the input i have String with 5 words.
Output will be 4 words without first one and must be stored in variable.
Already tried echo "First Second Third Fourth Fifth" | cut -d " " -f2-
but i can't store result in variable.
Also i don't wont to see result of executing.
Use command substitution
like this:
result=$(echo "First Second Third Fourth Fifth" | cut -d " " -f2-)
echo "$result"
OR using pure BASH:
s="First Second Third Fourth Fifth"
echo "${s#* }"
OUTPUT:
Second Third Fourth Fifth