Slackware This Forum is for the discussion of Slackware Linux.
|
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.
|
|
12-04-2013, 09:20 AM
|
#1
|
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
|
Odd Behavior with fgrep: Slackware 14.1 64-bit
Doing a lot of fiddling and twiddling with PostgreSQL and Apache-Tomcat (building DSpace from scratch which requires Apache-Ant and Apache-Maven in addition). A few stops and starts of the DBMS and Tomcat.
I've been seeing nothing returned from
Code:
ps -ef | fgrep post
<and/or>
ps -ef | fgrep tom
when I know one or both is running.
I use fgrep out of long ( really long) habit -- used to be you didn't have a lot of horsepower or memory and fgrep ( fast grep) didn't load all of grep for a quick and dirty. Got in the habit and just keep on doing it, good, bad or indifferent. Hangover from System 3 and SVR4, I suppose.
Anyway, this isn't just one time, it's a bunch of times. Close the terminal, open a new terminal, exit Xfce, execute the command in console, log out, log back in, run it in console, startx and run it in a terminal, no joy.
Then, for whatever reason, the command works.
I dunno why (either does or doesn't); I'm not fumble-fingering, I'm not bumping a Ctrtl or Alt key and it's a keyboard, not a finger pad.
Tiz a puzzlement -- any ideas (other than well, quit using fgrep, stupid)?
|
|
|
12-04-2013, 03:02 PM
|
#2
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,314
|
I don't think I've ever used fgrep - until some testing just now. I also see inconsistent results.
Unless you plan to spend some time in (for example) strace output, I'd reckon your final idea is the best bet.
|
|
|
12-04-2013, 04:13 PM
|
#3
|
LQ 5k Club
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,487
|
Perhaps 'pgrep -l post' or pgrep -l tom' would satisfy your needs?
|
|
|
12-05-2013, 10:10 AM
|
#4
|
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Original Poster
|
Glad to know it's not "just me." fgrep is a base utility included in Unix and Linux systems since like forever; ought to work properly. I've got some time today to dig and see what, if anything, I can find. Nothing worse that intermittent...
The man page says that direct invocation of egrep or fgrep are deprecated (dammit), "but is provided to allow historical applications that rely on them to run unmodified." Oh, yeah? Well, I'm an historical application and I do rely on them even if I am a little (well, a lot) deprecated too..
A little looking around shows three different sizes for the "grep family:"
Code:
-rwxr-xr-x 1 root root 140632 Sep 4 2012 /bin/egrep*
-rwxr-xr-x 1 root root 104120 Sep 4 2012 /bin/fgrep*
-rwxr-xr-x 1 root root 343464 Sep 4 2012 /bin/grep*
and it could be that egrep and fgrep are just launchers that invoke grep with grep -E and grep -F. In any case, though, there's something not quite right.
If I remember correctly, egrep and fgrep are just striped down versions of grep, the idea being that you don't need all of grep's capabilities for a quick-'n'-dirty pattern match (back when you were running on 64K of RAM and a 50MB disk drive that mattered).
Reading back, I just noticed the date stamps on the executables -- 2012? Maybe a rebuild with the 14.1 libraries is in order? Hmm.
Time to dig.
Last edited by tronayne; 12-05-2013 at 10:16 AM.
|
|
|
12-05-2013, 10:27 AM
|
#5
|
Senior Member
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Rep:
|
I use fgrep all the time, for the same reason as you -- ancient habit. (btw, I vaguely remember seeing someone purporting to show that modern grep is faster than fgrep, though that didn't get me out of the fgrep habit).
Anyway, fwiw, I've not noticed fgrep disgracing itself lately (or ever), but you've certainly got me on the lookout.
|
|
|
12-05-2013, 12:53 PM
|
#6
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
IIRC, on slackware fgrep and egrep are wrappers to grep. fgrep as a separate program is still included in the sources and I install and use it as it is a bit faster than the full grep. Recently, after a long search I found a tiny, but full-featured grep implementation, but alas, it is slower than the full grep...
|
|
|
12-05-2013, 04:56 PM
|
#7
|
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Original Poster
|
Well, I don't know about the wrapper part (except for the POSIX shell scripts listed below?). The "grep" programs all seem to be binary:
Code:
file /bin/grep*
/bin/grep: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped
fubar-trona-/home/trona: file /bin/*grep
/bin/egrep: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped
/bin/fgrep: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped
/bin/grep: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped
/bin/zegrep: POSIX shell script, ASCII text executable
/bin/zfgrep: POSIX shell script, ASCII text executable
/bin/zgrep: POSIX shell script, ASCII text executable
and all have sizes as listed in the post above.
Maybe they're fork-and-exec'd? Don't think so, 'cause they'd be the same size as grep if it's one of those "the command you provided makes it look like something else" thing (like vi used to be when it was really ex you were executing in "visual mode."
Like I said, a puzzlement.
|
|
|
All times are GMT -5. The time now is 03:22 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
|
|