The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Put the output of grep in a variable big123456 Shell Programming and Scripting 3 04-23-2008 08:40 AM
output of grep useless79 Shell Programming and Scripting 3 09-18-2007 02:36 AM
substitute the grep output jasmeet100 Shell Programming and Scripting 1 10-11-2005 04:40 PM
pausing a script gozer13 Shell Programming and Scripting 6 04-19-2005 01:58 PM
Strange output from grep Bab00shka UNIX for Dummies Questions & Answers 10 11-09-2004 03:23 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-14-2005
Registered User
 

Join Date: Mar 2005
Posts: 14
Pausing a Grep output

I am writing a small script which allows users to grep multiple log files across multiple directories, and often the output produced by the grep statements is quite lengthy. It would be nice if the output to the screen could be "paused" when it reaches a certain length (say, the length of the screen), and resumed once the user hits a key. I would rather not output the results to a file, but if the screen output cannot be tamed I may have no choice.
Reply With Quote
Forum Sponsor
  #2  
Old 06-14-2005
Registered User
 

Join Date: May 2005
Posts: 46
grep problem

use

grep "var" filename | less
Reply With Quote
  #3  
Old 06-14-2005
Lestat's Avatar
Registered User
 

Join Date: Feb 2005
Location: Quito - Ecuador
Posts: 67
use

| more

after your 'grep' commands
Reply With Quote
  #4  
Old 06-14-2005
Registered User
 

Join Date: May 2005
Posts: 46
grep command

Use

grep command | less

as ' less ' has more capabilities than ' more ' .
Reply With Quote
  #5  
Old 06-14-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
But less is available on fewer systems than more.

Cheers
ZB
Reply With Quote
  #6  
Old 06-15-2005
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,262
I would strongly discourage any such thing.

If the user wants to have the output paginated he can pipe itself through "pg", "more", "less" or whatever is his favourite paginating program. If the user wants to use the output in any other way (like: capture it in a file, feed it to another program in a pipe, ...) the usage of a paginating software inside the script would prevent all these possibilities.

bakunin
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0