LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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,008

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
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: 12,129

Rep: Reputation: 986Reputation: 986Reputation: 986Reputation: 986Reputation: 986Reputation: 986Reputation: 986Reputation: 986
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
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,379

Rep: Reputation: 824Reputation: 824Reputation: 824Reputation: 824Reputation: 824Reputation: 824Reputation: 824
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,008

Original Poster
Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
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
Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 321
Blog Entries: 4

Rep: Reputation: 299Reputation: 299Reputation: 299
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,750

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
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,008

Original Poster
Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
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


All times are GMT -5. The time now is 10:34 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration