I have a file that looks like this:
5.3.236.113681.2225191122.986.3705653211.104 4
5.3.236.113681.2225191122.986.3705653211.104.3402 45
5.3.236.0.1.20549687.20.93.9.2.234266672113.4455 2
5.3.236.113681.5829104.986.3705653211.119 8
5.3.236.2.01107.50.01.24.48685.30000018053113560818700000112 172
A basic grep will show these results; it shows an additional match which I do not want.
$ grep 5.3.236.113681.2225191122.986.3705653211.104 test.txt
5.3.236.113681.2225191122.986.3705653211.104 4
5.3.236.113681.2225191122.986.3705653211.104.3402 45
I tried greping for a "fixed string"; it shows an additional match which I do not want.
$ grep -F 5.3.236.113681.2225191122.986.3705653211.104 test.txt
5.3.236.113681.2225191122.986.3705653211.104 4
5.3.236.113681.2225191122.986.3705653211.104.3402 45
I tried greping for just the match; it shows an additional match which I do not want.
$ grep -w 5.3.236.113681.2225191122.986.3705653211.104 test.txt
5.3.236.113681.2225191122.986.3705653211.104 4
5.3.236.113681.2225191122.986.3705653211.104.3402 45
This works, but it looks like it's technically greping for the string I want plus the space, which seems more like a workaround than actually targeting specifically what I want.
$ grep "5.3.236.113681.2225191122.986.3705653211.104[[:space:]]" test.txt
5.3.236.113681.2225191122.986.3705653211.104 4
The problem with the one that worked is the desired string may not have space at the end, it may have the space at the front like this:
4 5.3.236.113681.2225191122.986.3705653211.104
45 5.3.236.113681.2225191122.986.3705653211.104.3402
The command that worked previously won't work on a list formatted a little differently.
I could simply write grep "[[:space:]]5.3.236.113681.2225191122.986.3705653211.104
but I don't want to have to re-write the grep for each little difference like that.
I would like to be able to grep for that string and show the whole line, regardless of how or where that line shows up in the text.