/usr/bin/pbn2dds is in pescetti 0.5-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 37 38 39 | #!/bin/sh --
# dds order: W N E S
PBN="$1"
RESULT="$1"
RESULT=${RESULT%.pbn}
RESULT=${RESULT%.PBN}
RESULT=${RESULT}.dds
if [ -z "$PBN" ]; then
echo "Usage: pbn2dds <foo.pbn>"
exit 1
fi
IFS='
'
( for i in `grep -i 'deal ' "$PBN"`; do
DEALER="`echo $i | sed 's/^.*"\(.\):.*$/\1/'`"
HANDS="`echo $i | sed 's/^.*:\(.*\)".*$/\1/'`"
case $DEALER in
"W")
echo $HANDS
;;
"N")
echo $HANDS | awk '{print $4" "$1" "$2" "$3}'
;;
"E")
echo $HANDS | awk '{print $3" "$4" "$1" "$2}'
;;
"S")
echo $HANDS | awk '{print $2" "$3" "$4" "$1}'
;;
*)
echo "ERROR: dealer is $DEALER"
exit 1
;;
esac
done ) > $RESULT
|