lyx_mirror/development/cmake/po/cat.py
Kornel Benko b5ec78f6e5 Removed _one_ perl-dependency in creating po-files.
'cat.py' created by Richard Heck

This script resembles the unix command 'cat', valid now on every
platform.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34828 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-09 19:02:04 +00:00

36 lines
566 B
Python

#! /usr/bin/env python
import sys
from getopt import getopt
usage = '''
python cat.py -o OUTFILE FILE1 FILE2 .... FILEn
Replacement for:
cat FILE1 FILE2 ... .FILEn > OUTFILE
If the -o argument is not given, writes to stdout.
'''
outfile = ""
(options, args) = getopt(sys.argv[1:], "ho:")
for (opt, param) in options:
if opt == "-o":
outfile = param
elif opt == "-h":
print usage
sys.exit(0)
out = sys.stdout
if outfile:
out = open(outfile, "w")
for f in args:
fil = open(f, "r")
for l in fil:
out.write(l)
fil.close()
if outfile:
out.close()