Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Python Script to edit a text file
I am really new to python and have used it to carry out some simple tasks but I would like to get a script working that will edit a text file for me. I want to strip out all the things I dont need and jsut leave what I do.
For instance I have a file called file.txt that looks as follows:
--- LOG Start: 06/07/2004 12:43:54
--- Information on log file
Now this is the format of what I have the log file in. I have removed any information that is sensitive but each line does begin with the same word_ like that. What I would like to have is a script that I can run against file.txt and keep just the numbers so it would output a new file that contained just:
So as you see I would get rid of the first two lines totally and then after taht keep just the numbers. I am still looking on the python tutorials but I thought this might be worth getting some help here. Thanks for your time,