chiark / gitweb /
ubuntu-daily: flip -a semantics to mean --authenticated, not --anonymous
[bin.git] / grab-string
1 #! /bin/sh
2
3 PREFIX=
4 if [ "$1" = --prefix ]; then
5         PREFIX="$2-"
6         shift 2
7 fi
8
9 if [ $# -lt 2 ]; then
10         echo "Usage: $0 [--prefix PREFIX] OLD-TREE STRING" >&2
11         exit 1
12 fi
13
14 if ! [ -d debian/po-new ]; then
15         cp -a debian/po debian/po-new
16 fi
17
18 for x in $1/*.po; do
19         base=$(basename $x)
20         base="${base#$PREFIX}"
21         [ -e "debian/po-new/$base" ] || continue
22         msgconv -t UTF-8 $x | \
23                 msgattrib --translated - | \
24                 msggrep -K -e "$2" - | \
25                 msgconv -t $(po-charset debian/po-new/$base) - | \
26                 msgcat --use-first debian/po-new/$base - | \
27                 sponge debian/po-new/$base
28 done
29
30 exit 0