Reputation: 1220
I have a text file Input.txt
7643 , PHP/5.6.16
7649 , PHP/5.3.10-1ubuntu3.21
10230 , PHP/5.3.10-1ubuntu3
14415 , PHP/5.6.17
14414 , PHP/5.5.9-1ubuntu4.11
24536 , PHP/5.3.3
24534 , PHP/5.3.3
14204 , PHP/5.4.45
1292 , PHP/5.5.33-1~dotdeb+7.1
5639 , PHP/5.3.3
5635 , PHP/5.5.31
8480 , PHP/5.4.45-0+deb7u2
8484 , PHP/5.3.29
8486 , PHP/5.5.9-1ubuntu4.14
355 , PHP/5
When I grep for the exact PHP version 5, It returns all the lines containing PHP/5
.
I tried using:
grep -w "PHP/5" Input.txt
How to get the exact string PHP/5
from the input?
Upvotes: 1
Views: 78
Reputation: 786339
You can use:
grep -w "PHP/5[[:blank:]]*$" file
355 , PHP/5
[[:blank:]]*$
will match 0 or more spaces followed by end of line after PHP/5
.
Upvotes: 1