Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting lines from a file

Status
Not open for further replies.

crasho2001

Technical User
Jun 13, 2002
51
0
0
TR
Hi,

I am reading a log file regularly. I want to delete lines after reading. Size of log file will not increase any more.

How can I delete lines from a file without changing log file name?

 
Hi

Probably the tool you use rewrites the file. If the file's node number changes, it is not the same file anymore and applications which had it open and wrote into it will not be able to access it anymore until you restart them.
Code:
cat /dev/null > /log/file

Feherke.
 
Hi,

"cat /dev/null" is an option but it will delete also unread lines. While I am reading the file, a new lines can be added.

For example I need to delete lines from 1 to 99.

Not the other ones.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top