Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2010 08:24 PM
тАО11-11-2010 08:24 PM
Grep
in my server there are 2 users abc abc1
when i login as abc the following thing does not work
$ grep c*
c
cc
..
as the i/p(c,cc,..) matches the regular expression c* i should get the o/p i.e grep must echo back the i/p
But thats not the case
Whereas when i login as abc1 the things are fine.
The . files in both users home directory are same.
Even the shell is same.
Can somebody help me out.
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2010 08:43 PM
тАО11-11-2010 08:43 PM
Re: Grep
That's one way to look at it.
> $ grep c*
What, exactly, do you expect this to do?
What, exactly, are you trying to do?
man grep
> The . files in both users home directory
> are same.
Who cares?
echo c*
Are _those_ the same?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2010 08:57 PM
тАО11-11-2010 08:57 PM
Re: Grep
Please explain what is grep c*!! I don't understand how grep works without a filename as an argument. The command you have executed should typically generate a core file and prob killed by a signal.
Help me understand!
When you do a grep c*, where are you searching for the pattern that contains c*?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2010 09:45 PM
тАО11-11-2010 09:45 PM
Re: Grep
> typically generate a core file and prob
> killed by a signal. [...]
Let's not get carried away. It may not make
much sense, but it could easily work (in
some sense). For example:
alp$ ls -l
total 2
-rw-r----- 1 SMS 40 2 Nov 11 23:35 c
-rw-r----- 1 SMS 40 26 Nov 11 23:34 c1
-rw-r----- 1 SMS 40 31 Nov 11 23:35 c2
-rw-r----- 1 SMS 40 15 Nov 11 23:40 c3
alp$ grep c*
c1:This file contains a "c".
c2:This file also contains a "c".
I don't understand what's desired here, and
I suspect that this command is useless, but
that doesn't mean that the command is pure
poison.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2010 09:52 PM
тАО11-11-2010 09:52 PM
Re: Grep
In my example, of course:
alp$ echo c*
c c1 c2 c3
so:
grep c*
is equivalent to:
grep c c1 c2 c3
which is easy to demonstrate:
alp$ grep c c1 c2 c3
c1:This file contains a "c".
c2:This file also contains a "c".
(The command is still pretty useless, but
"grep" does what it's told.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2010 11:34 PM
тАО11-11-2010 11:34 PM
Re: Grep
I am testing my regular expressions using
grep c*.
I m providing the text from keyboard
The text that matches my regular expression is echoed back on screen
for e.g
grep c*
c #i/p text
c #o/p of grep as c matches c*
did u get what i need?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2010 12:32 AM
тАО11-12-2010 12:32 AM
Re: Grep
Just about ALL REs need to be quoted. Unless you tell the shell not to do globbing.
grep "c*"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-15-2010 12:49 AM
тАО11-15-2010 12:49 AM
Re: Grep
In your example you should not get a match when you use "c*" .
Looks like you are mixing up pattern matching with Regular Expressions used in grep with pattern matching in `ls` (globbing: http://en.wikipedia.org/wiki/Glob_%28programming%29