Re: Strange behavior from grep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]





On Fri, Mar 28, 2008 at 9:37 AM, Mário Gamito <gamito@xxxxxxxxx> wrote:
Well, my question now is, how do I get the word 'gamito' alone from the file ?

Any help would be appreciated.


What are you really trying to do?

grep 'gamito' file and
grep -c 'gamito' file   will tell you if it is present.
grep -n 'gamito' file   will tell you which line(s) it is on.
grep -o 'gamito' file   only gives you the word 'gamito' is in or not.
grep -C3 'gamito' file   should give 3 context lines

There are also sed and awk commands which might be useful.
But the real answer depends on what you will do with the info.

-Bob
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux