LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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
  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: 518

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: 21,140

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


Reply



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
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:36 PM.

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