File: produceRGStats.sh

package info (click to toggle)
rosegarden4 1.0-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 22,344 kB
  • ctags: 14,022
  • sloc: cpp: 131,139; sh: 9,429; perl: 2,620; xml: 2,231; makefile: 607; python: 374; ansic: 339; ruby: 173; php: 2
file content (40 lines) | stat: -rwxr-xr-x 1,021 bytes parent folder | download | duplicates (2)
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
40
#!/bin/bash

filename=$1

if [ "X${filename}" = "X" ]
then
    echo "usage: `basename $0` <rg4 file>"
    exit 1
fi

if [ ! -f $filename ]
then
    echo "\"${filename}\" file doesn't exist"
    exit 1
fi

targetFilename=`echo ${filename}|sed -e "s/\.rg$/.xml/g"`

#echo "output filename = ${targetFilename}"

if [ ${targetFilename} = ${filename} ]
then
    echo "${filename} doesn't appear to be a valid RG file"
    exit 1
fi

tempFile=".tmpFile"

# uncompress and rename
/bin/gunzip -c ${filename} > ${tempFile}

# add the XSL link
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > ${targetFilename}
#echo "<?xml-stylesheet type=\"text/xsl\" href=\"http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/rosegarden/gui/testfiles/rg-stats.xsl?rev=HEAD&content-type=text/plain\"?>" >> ${targetFilename}
echo "<?xml-stylesheet type=\"text/xsl\" href=\"rg-stats.xsl\"?>" >> ${targetFilename}

count=`wc -l ${tempFile} |awk '{ print $1}'`
count=`echo "${count} - 2"|bc`
tail -${count} ${tempFile} >> ${targetFilename}