linux - Use grep to search for words beginning with letter "s" -


i'm trying use grep through file, , find words starting lowercase letter "s". snippet of file:

sjpope   pts/2    161.133.12.95    10:21am 43.00s  0.13s  0.01s  man bc rmschalk pts/3    161.133.9.147    10:22am  1.00s  0.10s  0.02s  vi testb jntrudel pts/4    161.133.9.11     10:23am  2.00s  0.09s  0.00s  vi testb tjbanks  pts/5    161.133.9.70     10:41am  8.00s  0.06s  0.04s  -ksh 

i want output have line stating "s".

for these want search words starting given letter not lines one-liner do:

grep -e '\bs' file.txt # words starting s grep -e 's\b' file.txt # words ending s 

i know non standard grep behavior (\b regex anchor means word break not in extended regular expressions standard) works on modern systems.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -