LinuxQuestions.org
Help answer threads with 0 replies.
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, 01: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 01:37 PM.
 
Old 11-22-2011, 01:55 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 02: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, 02:48 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 03: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, 03:08 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 04:54 PM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Code:
tail -n +1 -f
That will print the entire file.
 
2 members found this post helpful.
Old 11-22-2011, 04:59 PM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

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

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

All times are GMT -5. The time now is 07:44 AM.

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