Doubt in grep command

Page 3 of 3 Previous  1, 2, 3

Go down

Re: Doubt in grep command

Post by Vineet_More on Tue Mar 16, 2010 6:29 pm

I think the single quote doesn't matter in the scenario!!!

Vineet_More

Posts : 27
Points : 31
Join date : 2010-02-26

View user profile

Back to top Go down

Re: Doubt in grep command

Post by Saradha Kannan on Tue Mar 16, 2010 6:48 pm

hmmm okay.. pls come to a conclusion and lemme know..Smile

Saradha Kannan

Posts : 25
Points : 25
Join date : 2010-03-04

View user profile

Back to top Go down

Re: Doubt in grep command

Post by Maithreyi on Tue Mar 16, 2010 6:50 pm

Here ^ stands for negation.The output shows all lines which contain characters other than abcd.Since all your lines in the file have characters other than abcd, all lines are printed.

This is the conclusion! And quotes doesn't matter!

Maithreyi

Posts : 76
Points : 142
Join date : 2010-03-03
Age : 30
Location : Haldia

View user profile

Back to top Go down

Re: Doubt in grep command

Post by Saradha Kannan on Tue Mar 16, 2010 6:53 pm

okie:) thnx all of ya Smile

Saradha Kannan

Posts : 25
Points : 25
Join date : 2010-03-04

View user profile

Back to top Go down

Re: Doubt in grep command

Post by ARVINTH B.J on Fri Mar 19, 2010 4:32 pm

[336560@oracleclient commands]$ cat 5.txt
asdf
1234
asdrg
awsrdq
kjhgkji


[336560@oracleclient commands]$ grep [^asd] 5.txt
1234


According to the conclusion made.,
The output should print all lines which contains characters other than a,s and d. So all lines must have been printed. But it isn't the case.

I thought it works this way. Prints all lines which has neither of the characters inside [ ].
If it works this way,last 2 lines should have been printed. But it isn't the case too

Someone explain.

ARVINTH B.J

Posts : 20
Points : 31
Join date : 2010-02-26

View user profile

Back to top Go down

Re: Doubt in grep command

Post by Maithreyi on Fri Mar 19, 2010 5:05 pm

Code:

cat > 5.txt
asdf
1234
asdrg
awsrdq
kjhgkji

[335818@oracleclient ~]$ grep [^asd] 5.txt
asdf
1234
asdrg
awsrdq
kjhgkji

This is the output I got.I don't understand why you get a different output!

Maithreyi

Posts : 76
Points : 142
Join date : 2010-03-03
Age : 30
Location : Haldia

View user profile

Back to top Go down

Re: Doubt in grep command

Post by jennyinhere on Tue Mar 23, 2010 4:18 pm

ls | grep "a*"

is displaying all the files in the directory including those whose names do not contain a

What is the error?

jennyinhere

Posts : 24
Points : 30
Join date : 2010-02-26
Age : 30

View user profile

Back to top Go down

Re: Doubt in grep command

Post by jennyinhere on Tue Mar 23, 2010 4:20 pm

How to use -l with grep command?

jennyinhere

Posts : 24
Points : 30
Join date : 2010-02-26
Age : 30

View user profile

Back to top Go down

Re: Doubt in grep command

Post by Christopher on Tue Mar 23, 2010 4:52 pm

Syntax
Code:
$ grep -l 'orange' *
This ll print name of all the files having 'orange'.
avatar
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 30

View user profile http://unixcpp.forumotion.com

Back to top Go down

Re: Doubt in grep command

Post by Sponsored content


Sponsored content


Back to top Go down

Page 3 of 3 Previous  1, 2, 3

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum