unix grep and tail

tail -n5000 xyz.log

above shows last 5000 lines right


if i want to see all the 15723 lines of xyz.log what command i have to give

tail -n5000 xyz.log|grep 'ERROR WS'
how to make above case sensitive search like
tail -n5000 xyz.log|grep 'error ws'
how to make above whole word search? so that i wont see below as result ERROR aaa WS etc


please advise
LVL 7
gudii9Asked:
Who is Participating?
 
Seth SimmonsConnect With a Mentor Sr. Systems AdministratorCommented:
above shows last 5000 lines right

yes

if i want to see all the 15723 lines of xyz.log what command i have to give

cat xyz.log

how to make above case sensitive search

grep is already case-sensitive by default; you would use -i with grep to ignore case

so that i wont see below as result ERROR aaa WS etc

if you put 'error ws' it will search for that phrase as-is
it will not return something with anything in between those words
1
 
dfkeCommented:
Hi,

actually use double quotes ".

grep -i "error ws" xyz.log

Open in new window


Cheers
1
 
skullnobrainsCommented:
recommend : accept ID: 42519838

reason : double quotes won't make a difference and actually make it run slower by enabling expansion and escaping with an additional error risk
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.