File: po4a-split

package info (click to toggle)
debian-reference 2.128
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,588 kB
  • sloc: python: 586; makefile: 572; sh: 526; sed: 80
file content (36 lines) | stat: -rwxr-xr-x 681 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# Copyright (C) 2009 Osamu Aoki <osamu@debian.org>
#
# This is free software with ABSOLUTELY NO WARRANTY.
#
# You can redistribute it and/or modify it under the terms of
# the GNU General Public License version 2 or later.
# 
# Split PO file.
#
#    po4a-strip chunks file.po
#
#    ... output file.1.po file.2.po into chunks
#
#  Use "wc -l file.po" to get rough idea.
#
c=$1
filein=$2
m=$( wc -l <$filein )
n=$(( $m/$c ))
fileout=${filein%.po}
i=1
l=1
while read X ; do
  echo "$X" >> $fileout.$i.po
  #echo $n $l $(( $n*$i )) $i
  if [ $l -ge $(( $n*$i )) ] && [ -z "$X" ]; then
    i=$(($i+1))  
  fi
  l=$(($l+1))
done < $filein

#
#
# vim: set sts=2 ai expandtab: