1831345 Members
3098 Online
110024 Solutions
New Discussion

grep

 
SOLVED
Go to solution
kestens jan
Occasional Contributor

grep

Hi,

This could be basic stuff,but I need help

I have a file on which I do :
grep "string" file.

output :

stringa
stringbe
stringc

For my script I need only the last entry of the grep result.
How can I isolate this entry.
(this case stringc)


3 REPLIES 3
Steve Steel
Honored Contributor
Solution

Re: grep

Hi


grep "string" file|tail -n 1

Is easiest


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
T G Manikandan
Honored Contributor

Re: grep

cat |grep -E "stringc"
kestens jan
Occasional Contributor

Re: grep

Sorry TG, but Steve's answer
was the one I'm looking for.

Greetz

Jan K