0

I'm just trying to figure out how to get everything after the first two words in a line. Right now, I've got the opposite - the first two words themself:

^(\S+ \S+)

I want the opposite of this.

Thanks!

3
Contributors
2
Replies
33
Views
4 Years
Discussion Span
Last Post by L7Sqr
1

I would suggest something other than grep in this case.
If you know the the delimeter is definitely a single space, you may use cut, otherwise use awk.

Example input (t.t):

one two three four five six
one two three four five six
one two three four five six
one two three four five six
one two three four five six

Using cut:

$ cut -d' ' -f 3- t.t
three four five six 
three four five six 
three four five six 
three four five six 
three four five six 

Using awk:

$ awk '{ s = ""; for (i = 3; i <= NF; i++) s = s $i " "; print s }' t.t
three four five six 
three four five six 
three four five six 
three four five six 
three four five six 
Votes + Comments
I like this solution
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.