LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 03-19-2009, 01:55 PM   #1
Zebe
LQ Newbie
 
Registered: Jun 2004
Distribution: Ubuntu
Posts: 13

Rep: Reputation: 0
Are results sent to an output file only at the end of a command sequence?


Hi All,

So I am running the following command to find all the files within a folder that contain either instance of a string:

Code:
egrep -lr "headerX|footerX" * >> ~/031909.txt
When I run the command without trying to push the results to an output file I start seeing matches after about a minute or so.

When trying to push the results to an output file (like the example above), there is nothing stored in the file after I let it continue running past the point where I first started seeing matches when testing just the base command (I did a more on the file in a new session while the command was still running. tail -f doesn't show anything as well).

I'm wondering if results are stored to the text file only after the command finishes? The command is going to take a while to run regardless. Just wanted to make sure this is the case, so I don't wait around for an hour to only get a blank file.

Thanks for any explanation or guidance, I appreciate it.
 
Old 03-19-2009, 04:45 PM   #2
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 517

Rep: Reputation: 39
Hi,
Results will go to the file imedietly as soon as any output is found.

I beleive its the '*' in your command that could be causing you a problem here. Your trying to search recursivly and using a '*' wildcard as well... replacing the '*' with a '.' will tell grep to search all files and folders from the directory your running the command in and recursivly through all folders. Just try it and see but i've had problems using grep with a * wildcard before, its like it creates a never ending loop... just sits and does nothing.

But definately results will go into the file imedietly.
 
Old 03-19-2009, 06:34 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,792

Rep: Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923
There will be buffering involved in both cases - just a matter of degree.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script format question - output command results in quotes Barefootpanda Linux - General 5 10-13-2008 11:40 PM
Pop3 Command stream end of file while reading line sesimonsen Linux - Networking 0 05-13-2005 12:29 PM
Can I redirect script output to a file without ">> $LOGFILE" at the end of each line davee Linux - General 1 12-19-2003 05:01 AM
Help: Command Output to File. rvijay Linux - Newbie 3 09-30-2003 09:02 AM
Command stream end of file tinaa Linux - Software 8 08-29-2003 02:15 PM


All times are GMT -5. The time now is 11:24 AM.

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