Making grep find files containing '$' (the dollar sign char).
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Making grep find files containing '$' (the dollar sign char).
grep (GNU grep) 2.5
Hi:
I want to find files containing the "$" char (ascii 0x24). 'Grep -irl $ *' would output the names of every file in path *, of course, because it means end of line (EOL). So giving grep the string "$" won't do. So I tried 'grep -irl \$ *'. But this doesn't work either and I do not understand why. Am I not escaping the dollar sign? grep should interpret it literally. Neither 'grep -irl "$" *' will work. Fortunately, there's LQ, besides grep's man page. Any hint? Thanks for reading.
That certainly worked and I thank you. But can somebody tell me what \$ is to grep? If \$ is a var name, then a second backslash will take away that meaning, leaving this one: escaped dollar sign; which in turn takes away the meaning "end of line" leaving a mere dollar sign. But is \$ really a var name to bash (or to the shell)?
EDIT: I'm very sorry. It's all wrong. I reread AlucardZero's post and think I've now got it right.
EDIT 2: one thinks LQers will get bored with the whole story, but sometimes it's the best option. So here it goes:
I know some ebook in the HDD contains this line:
Quote:
for i in $FILE
which is part of a script I want to consult. And so the need for grep. That's all.
All this is highly instructive, and thanks be given to these wonderful LQers. But then a question arises: how to know, save by careful study of a manual page, as of now several thousand lines long, the scope of things "eaten" by the shell and, therefor, what is left to programs like grep?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.