LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial 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
 
Search this Thread
Old 11-22-2011, 02:36 PM   #1
sparsh0mittal
LQ Newbie
 
Registered: Nov 2011
Posts: 23

Rep: Reputation: Disabled
linux text editor which updates file


I run simulations where output is printed in file. Is there a linux text editor which automatically updates files (while they are open and I am viewing them), in case it is not changed without asking (this will be something like console output). I will be thankful for the help.

Thanks
Sparsh

Last edited by sparsh0mittal; 11-22-2011 at 02:37 PM.
 
Old 11-22-2011, 02:55 PM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
You could use the tail command with the -f argument to watch text files live. Do you have the text editor open to edit the file while it is being updated, or do you just want to watch it live?

Edit - As an example:
Code:
tail -f /var/log/messages
 
Old 11-22-2011, 03:35 PM   #3
sparsh0mittal
LQ Newbie
 
Registered: Nov 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thanks. But tail command only shows the last lines.

My scenario is: while a simulation is going on, it prints same output in both std::cout and also a log file. After sometime, the std::cout stops printing any output, so I have to rely on the log file.

Now to understand the simulation, I need to understand the output while simulation is going on (they are long simulations). So if I use vim to open log file, it does not update the file (every time I have to close and open). So I was looking a gui/non-gui based editor, which could keep on updating my view of the log file.

Thanks.
 
Old 11-22-2011, 03:48 PM   #4
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Oh, ok... With vim, you can set the following:
Code:
:set autoread
From the man page/help files:
Quote:
When a file has been detected to have been changed outside of Vim and it has not been changed inside of Vim, automatically read it again. When the file has been deleted this is not done.
 
1 members found this post helpful.
Old 11-22-2011, 04:05 PM   #5
sparsh0mittal
LQ Newbie
 
Registered: Nov 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by corp769 View Post
Oh, ok... With vim, you can set the following:
Code:
:set autoread
Thanks a lot. That does the task.
 
Old 11-22-2011, 04:08 PM   #6
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Awesome! There a most likely other alternatives besides vim and tail, but if that works for you, then it works. Could you also mark your thread as solved, using the thread tools located at the top of the page? Thanks!

Cheers,

Josh
 
1 members found this post helpful.
Old 11-22-2011, 05:54 PM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Code:
tail -n +1 -f
That will print the entire file.
 
2 members found this post helpful.
Old 11-22-2011, 05:59 PM   #8
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Quote:
Originally Posted by MTK358 View Post
Code:
tail -n +1 -f
That will print the entire file.
Forgot about that. That works, but if the file is really big, then technically it is kind of pointless, if you really think about it, especially when you are using a regular terminal, instead of an emulator like gnome-terminal, etc.
 
  


Reply

Tags
editor, linux, text editor


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
Program addresses from text editor to ELF file. theKbStockpiler Linux - General 2 10-20-2011 03:04 AM
[SOLVED] Good editor to edit text file. sanjaydelhi Linux - Newbie 17 01-04-2011 10:10 PM
Need help appending text to lines in a file using vi editor tmbrwolf53 Linux - Newbie 3 10-31-2008 04:25 PM
Which light text editor can copy text from file and paste in browser? davidas Linux - Software 9 03-06-2006 12:28 PM
Getting rid of highlighting in a vi editor text file. Dee62 Linux - Newbie 6 03-11-2004 03:55 PM


All times are GMT -5. The time now is 05:12 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration