Reputation: 100190
Say I have this:
echo " word1 word2 word3" | awk '{print $1;}' # Prints "word1"
I want to remove everything before the beginning of the second token, so I want to keep word2 word3
..what I could do is just remove the first token and then trim the remainder, but I don't know how to keep everything but the first token.
Upvotes: 0
Views: 216
Reputation: 22291
echo " word1 word2 word3" | read skip rest
Will store just word2 word3 on rest
. See the read command in the bash man page.
Upvotes: 1
Reputation: 867
awk has for: echo " word1 word2 word3" | awk '{for(i=2;i<=NF;++i)print $i}'
Upvotes: 0