LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-04-2013, 08:20 AM   #1
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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)?
 
Old 12-04-2013, 02:02 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
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.
 
Old 12-04-2013, 03:13 PM   #3
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,357

Rep: Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739Reputation: 2739
Perhaps 'pgrep -l post' or pgrep -l tom' would satisfy your needs?
 
Old 12-05-2013, 09:10 AM   #4
tronayne
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
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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 09:16 AM.
 
Old 12-05-2013, 09:27 AM   #5
55020
Senior Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Blog Entries: 4

Rep: Reputation: Disabled
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.
 
Old 12-05-2013, 11:53 AM   #6
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
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...
 
Old 12-05-2013, 03:56 PM   #7
tronayne
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
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
awk sub odd behavior! fantasy1215 Programming 7 07-10-2012 07:55 AM
Odd monitor behavior drummerdan Slackware 1 05-17-2007 09:04 PM
Odd TCP Behavior Rawjoe Linux - Networking 1 12-14-2006 10:53 AM
postgresql odd behavior doublefailure Linux - Software 1 08-28-2002 12:40 AM
RH 6.2 ... odd behavior jubal Linux - Networking 3 02-27-2001 09:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration