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

Re: Wildcards



Timothy,

  The two symbols that you are asking about are parts of a 
"regular expression" search.  The $ is telling grep to search for
something at the end of a string.  Therefore, "/$" is looking for a /
(forward slash) as the last character in a string, (i.e. the ending
slash on a directory entry from ls -lF).

  The ^ symbol in your example below denotes a search at the beginning
of a string.  Therefore "^d" is looking for the letter d at the
beginning of a string, (i.e. the d permission on the ls -lF output.)

Hope this helps.  A really good book for understanding regular
expressions is "Master Regular Expressions" by Jeffrey Freidl (I hope
that is how its spelled.)  This is also known as the O'Reilly "Hip Owls"
book. 

Steve Mayer
smayer@rtd.com


timothy@smasher.rs.itd.umich.edu wrote:
> 
> Thanks for everyone's help.
> One more question that I couldn't find when I browsed the man pages.
> What does the '$' mean/do in "grep "/$""?
> and what does the '^' mean/do in "grep "^d""?
> Thanks,
> Timothy
> 
> On 08-Jun-98 David Lauder wrote:
> > For directories, try:
> >
> >     ls -lF | grep "/$"
> > or:
> >     ls -l | grep "^d"
> >
> > You could create an alias for this in your .bash_profile as "lsd":
> >
> >     alias lsd='ls -lF | grep "/$"'
> >
> >
> > For executables, try:
> >
> >     ls -lF | grep "*$"
> >
> >  And alias it as "lsx":
> >
> >     alias lse='ls -lF | grep "*$"'
> >
> > Do a "man ls" and "man grep" and experiment with some of the other
> > options.
> >
> ----------------------------------
> E-Mail: timothy@smasher.rs.itd.umich.edu
> Date: 08-Jun-98
> Time: 12:45:35
> 
> This message was sent by XFMail.
> Powered by GNU/Linux 2.0.
> ----------------------------------
> 
> --
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: