Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
11-14-2004, 02:05 PM
|
#1
|
Member
Registered: Aug 2003
Distribution: 10.3
Posts: 55
Rep:
|
Command line tools to Find files with specific text
What is the best tool to find all files with a string such as "PS1=" ?
I solved this one by letting the Find Files icon in KDE sort through the whole hard drive.
If I knew the likely candidates I could use cat | grep "PS1=" or maybe awk (just discovered this today). In DOS I would use For...in...do...find... but that does rely on knowing the likely candidates (usually by the three letter extensions).
Any suggestions?
Naps
|
|
|
11-14-2004, 02:38 PM
|
#2
|
LQ Newbie
Registered: Oct 2004
Distribution: Debian
Posts: 18
Rep:
|
What's wrong with just using grep?
something like:
Code:
grep -r -I -D skip "PS1=" /
-r : recursive
-I : ignore binary files
-D skip : skip device drivers
--
Kyle
|
|
|
11-14-2004, 02:59 PM
|
#3
|
Senior Member
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537
Rep:
|
Yea or so you can remeber that make a bash script so that it will run with them commands and you got your own home made search engine 
|
|
|
11-14-2004, 04:56 PM
|
#4
|
Member
Registered: Aug 2003
Distribution: 10.3
Posts: 55
Original Poster
Rep:
|
Thanks for the speedy replies, Mithrascruor and Exvor. More success using the / instead of the * I had used before. I don't know what's wrong but it goes through the windows directories twice, then after a couple of grep /proc entries, which return Invalid Argument, it stops. (I copied the windows partitions over to this box for the data, though I don't run it on this box). I don't know if this is peculiar to my distro Suse 9.1; I tried it on my laptop, which has a Debian based distro (Libranet 2.8.1) which would not run with the -D switch. It did find my .bashrc file in my home directory (I think SuSE makes it more difficult by using etc/profile referring to /etc/profile.local or some complex set-up) but then it stops after two "no such file or directory" entries in a /~/.kde directory.
Perhaps it is running out of memory (500Mb on the desktop and 384 on the laptop)? I would have thought it would crash more readily with a GUI, but maybe SuSE has built in a work-around for this?
Naps
|
|
|
11-14-2004, 06:19 PM
|
#5
|
Member
Registered: Jun 2004
Location: Florida
Distribution: Gentoo
Posts: 148
Rep:
|
grep was already mentioned, but if you're looking for the file with the 'PS1=' line in it (which I was not sure if you are or not), try /etc/profile and ~/.bash_profile -- one or the other should contain the PS1= line.
|
|
|
11-15-2004, 04:46 AM
|
#6
|
Member
Registered: Aug 2003
Distribution: 10.3
Posts: 55
Original Poster
Rep:
|
Quote:
Originally posted by Adrohak
<snip>one or the other should contain the PS1= line.
|
I guess knowing where to look is the answer.
Naps
|
|
|
All times are GMT -5. The time now is 04:23 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|