2012-11-28 17:15:12 +00:00
|
|
|
#!/usr/bin/env python
|
2013-01-23 18:34:11 +00:00
|
|
|
# Copyright (C) 2012-2013 Bastian Kleineidam
|
2012-11-28 17:15:12 +00:00
|
|
|
"""Remove all lines after a given marker line.
|
|
|
|
"""
|
|
|
|
from __future__ import print_function
|
|
|
|
import fileinput
|
|
|
|
import sys
|
|
|
|
|
|
|
|
def main(args):
|
2013-01-09 21:26:00 +00:00
|
|
|
"""Remove lines after marker."""
|
2012-11-28 17:15:12 +00:00
|
|
|
filename = args[0]
|
|
|
|
marker = args[1]
|
|
|
|
for line in fileinput.input(filename, inplace=1):
|
|
|
|
print(line.rstrip())
|
|
|
|
if line.startswith(marker):
|
|
|
|
break
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main(sys.argv[1:])
|