Dear visitor, welcome to VDR Portal. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
|
|
Source code |
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 41 42 |
#!/bin/bash
dir="/channels"
outdir="/tmp"
cd $dir
for a in S*conf ; do SAT=$(echo $a|cut -d _ -f1); cat $a | while read b ; do FIRST=$(echo $b|cut -d : -f-3 ) ; LAST=$(echo $b|cut -d : -f5- ) ; echo $FIRST:$SAT:$LAST >>tmp;done ; mv tmp $a ; done
if [ ${dir:${#dir}-1:${#dir}} != "/" ]
then
dir=$dir"/"
fi
for file in `ls ${dir}*.conf`
do
filename=${file/`dirname $file`/}
if [ ${filename:0:1} = "/" ]
then
filename=${filename:1:${#filename}}
fi
if [ -e $outdir/$filename ]
then
echo "File $filename already exists! Aborting this file."
continue
fi
touch $outdir/$filename
exec 3< <(sort -g -t : -k 2 $file)
tmp=""
while read line
do
T=`echo $line | cut -d: -f2`
if [ "$T" != "$tmp" ]
then
echo " " >> $outdir/$filename
echo ":== Frequency $T MHz ==" >> $outdir/$filename
fi
echo $line >> $outdir/$filename
tmp=$T
done <&3
exec 3<&-
done
|
|
|
Source code |
1 2 3 4 |
T=`echo $line | cut -d: -f6` if [ "$T" = "0" -o "$T" = "1" ] continue fi |
|
|
Source code |
1 2 3 |
./test.sh: line 38: syntax error near unexpected token `fi' ./test.sh: line 38: ` fi' vdr:~# |
|
|
Source code |
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 41 42 43 44 45 46 47 48 49 50 51 |
#!/bin/bash
dir="/channels"
#outdir="/tmp"
TV="/channels/TV"
rm -f $TV/*.conf
cd $dir
for a in S*conf ; do SAT=$(echo $a|cut -d _ -f1); cat $a | while read b ; do FIRST=$(echo $b|cut -d : -f-3 ) ; LAST=$(echo $b|cut -d : -f5- ) ; echo $FIRST:$SAT:$LAST >>tmp;done ; mv tmp $a ; done
if [ ${dir:${#dir}-1:${#dir}} != "/" ]
then
dir=$dir"/"
fi
for file in `ls ${dir}*.conf`
do
filename=${file/`dirname $file`/}
if [ ${filename:0:1} = "/" ]
then
filename=${filename:1:${#filename}}
fi
if [ -e $TV/$filename ]
then
echo "File $filename already exists! Aborting this file."
continue
fi
touch $TV/$filename
exec 3< <(sort -g -t : -k 2 $file|sed "s/(null)/Unknown/g"|sed -e 's/[a-zA-Z]/\U&/g')
tmp=""
while read line
do
T=`echo $line | cut -d: -f6`
if [ "$T" = "0" -o "$T" = "1" ]
continue
fi
T=`echo $line | cut -d: -f2`
if [ "$T" != "$tmp" ]
then
echo " " >> $TV/$filename
echo ":== Frequency $T MHz ==" >> $TV/$filename
fi
echo $line >> $TV/$filename
tmp=$T
done <&3
exec 3<&-
done
|

|
|
Source code |
1 2 3 4 5 |
T=`echo $line | cut -d: -f6`
if [ "$T" = "0" -gt "$T" = "1" ]
then
continue
fi
|
|
|
Source code |
1 |
./test.sh: line 88: [: too many arguments |
This post has been edited 1 times, last edit by "neptunvasja" (Jul 14th 2008, 7:16pm)
Äääh ja
Quoted
Original von Ioannis
Fehlt da nicht ein "then" zwischen Zeile 36/37?
. -gt geht da nicht, da es sich nicht um Zahl-Variablen handelt.
Quoted
Original von neptunvasja
Jetzt habe ich nach eine Lösung gesucht, dass man die Zeilen rausschmeissen soll, da habe also statt -o das -gt eingefügt, das hat natürlich nicht geklappt. Wie ist denn eigentlich der richtige Syntax?
Quoted
if [ ! "$T" = "0" -a ! "$T" = "1" ]
This post has been edited 1 times, last edit by "SHF" (Jul 15th 2008, 11:33pm)
|
|
Source code |
1 |
cat /channels/RADIO/*.conf|cut -d":" -f6 | sort | uniq > test.conf |
|
|
Source code |
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 |
0 100 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 101 1010 1011 1012 1013 1014 1015 1016 1017 1018 1020 1021 1024 1025 1026 103 1042 105 1056 1060 106+105 1065 1071 ........ |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
100 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 101 1010 1011 1012 1013 1014 1015 |