python file manipulation
- by lakshmipathi
I have a directory /tmp/dir with two types of file names
/tmp/dir/abc-something-server.log
/tmp/dir/xyz-something-server.log
..
..
and
/tmp/dir/something-client.log
I need append a few lines (these lines are constant) to files end with "client.log"
line 1
line 2
line 3
line 4
append these four lines to files end with "client.log"
and For files end with "server.log"
I needed to append after a keyword say "After-this".
"server.log " file has multiple entries of "After-this" I need to find the first entry of "After-this" and append above said four lines keep the remaining file as it is.
Any help will be great appreciated :) Thanks in advance.