Hi,
Thank you for your answer.
After a little more research, I found out that the line containing the word 'gamito' is huge and yet it scrolls so fast in the screen that I can barely see it.
I tried redirecting the output of the grep to a file and that huge line went in to it.
So, I've tried a double grep:
$ grep 'gamito' file | grep 'gamito'
but without success.
Well, my question now is, how do I get the word 'gamito' alone from the file ?
Any help would be appreciated.
Warm Regards, Mário Gamito
On Fri, Mar 28, 2008 at 1:27 PM, Dan Halbert halbert@everyzing.com wrote:
If I run $ grep 'gamito' file
What is the return status (echo ??). If you had a file with "gamito\r " then it would print what looked like a blank line, I think. So is this maybe a Mac file? Which version of grep, etc., etc. Do "where grep".
it returns nothing. Yet, if I run $ grep -c 'gamito' file
It returns 1 which is right.
On Mar 28, 2008, at 9:37 AM, Mário Gamito wrote:
Well, my question now is, how do I get the word 'gamito' alone from the file ?
grep -o 'gamito' file
-steve
-- If this were played upon a stage now, I could condemn it as an improbable fiction. - Fabian, Twelfth Night, III,v
On Fri, Mar 28, 2008 at 9:37 AM, Mário Gamito gamito@gmail.com wrote:
Hi,
Thank you for your answer.
After a little more research, I found out that the line containing the word 'gamito' is huge and yet it scrolls so fast in the screen that I can barely see it.
I tried redirecting the output of the grep to a file and that huge line went in to it.
So, I've tried a double grep:
$ grep 'gamito' file | grep 'gamito'
but without success.
Well, my question now is, how do I get the word 'gamito' alone from the file ?
Any help would be appreciated.
Warm Regards, Mário Gamito
I'm not a sed user but I believe that would do it for you. Someone else can no doubt fill the blanks. I believe you could also do it with awk as it also accepts a regular express in its syntax.
Jacques B.
On Fri, Mar 28, 2008 at 9:37 AM, Mário Gamito gamito@gmail.com 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
Mário Gamito wrote:
Hi,
Thank you for your answer.
After a little more research, I found out that the line containing the word 'gamito' is huge and yet it scrolls so fast in the screen that I can barely see it.
I tried redirecting the output of the grep to a file and that huge line went in to it.
So, I've tried a double grep:
$ grep 'gamito' file | grep 'gamito'
but without success.
Well, my question now is, how do I get the word 'gamito' alone from the file ?
Perhaps try to chop the line down to size by using fold or split.