]> git.lyx.org Git - lyx.git/blob - development/cmake/po/cat.py
Sorry, vorgotten a dependency.
[lyx.git] / development / cmake / po / cat.py
1 #! /usr/bin/env python
2
3 import sys
4 from getopt import getopt
5
6 usage = '''
7 python cat.py -o OUTFILE FILE1 FILE2 .... FILEn
8
9 Replacement for:
10         cat FILE1 FILE2 ... .FILEn > OUTFILE
11 If the -o argument is not given, writes to stdout.
12 '''
13
14 outfile = ""
15
16 (options, args) = getopt(sys.argv[1:], "ho:")
17 for (opt, param) in options:
18         if opt == "-o":
19                 outfile = param
20         elif opt == "-h":
21                 print usage
22                 sys.exit(0)
23
24 out = sys.stdout
25 if outfile:
26         out = open(outfile, "w")
27
28 for f in args:
29         fil = open(f, "r")
30         for l in fil:
31                 out.write(l)
32         fil.close()
33
34 if outfile:
35         out.close()