The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Deleting lines inside a file without opening the file toms Shell Programming and Scripting 3 09-24-2007 07:58 AM
Opening a file during FTP ceaker High Level Programming 1 04-01-2006 02:40 AM
delete file without opening vi lweegp UNIX for Dummies Questions & Answers 7 01-25-2006 02:23 PM
opening a file hiei UNIX for Dummies Questions & Answers 4 04-01-2004 12:24 AM
File Opening in C++ in Unix Env skannan High Level Programming 0 06-15-2002 08:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-02-2006
monkfan monkfan is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 22
Opening output file while still in process

Dear guru,

Say I have a long process that is executed in this way:

$ nohup perl mycode.pl > output.txt &

Now if I want to view the output file with vi, while process
still running:

$ vi output.txt

Will it kill the process? (seems to me it does). If so how can view the file
without having to kill it.

Thanks and hope to hear from you again.

Regards,
Edward
  #2 (permalink)  
Old 03-02-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Try

Code:
cat output.txt
Better yet,
Code:
tail -f output.txt
  #3 (permalink)  
Old 03-02-2006
monkfan monkfan is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 22
Thanks. One more thing, how about copying file before opening it?

$cp outfile.txt newname.txt

$vi newname.txt

Will it kill the process?
  #4 (permalink)  
Old 03-02-2006
gauravgoel gauravgoel is offline
Registered User
  
 

Join Date: Dec 2005
Location: India
Posts: 218
Quote:
Originally Posted by monkfan
Thanks. One more thing, how about copying file before opening it?

$cp outfile.txt newname.txt

$vi newname.txt

Will it kill the process?
No it will not kill the process

Gaurav
  #5 (permalink)  
Old 03-02-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
the process that is dumping data to an output file will not be killed
untill the environment or the user is changing the permission bits of the file to which it is dumped, or file descriptor problem, invalidating file handler etc.

when we want to view the file where data is dumped the shell provides you with a different file handler without affecting the prime process that is dumping into the file. Hence there is no consistency problem as far as reading a file and taking a copy is concerned.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 07:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0