Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: printing channel list



On Fri, May 28, 2004 at 12:41:05PM +0200, Nicolas Huillard wrote:
> Matthias Mueller wrote:
> 
> >On Fri, May 28, 2004 at 12:06:40PM +0200, Wolfgang Rohdewald wrote:
> >
> >>TV:
> >>1 ARD
> >>2 ZDF
> >>
> >>Radio:
> >>500 Swiss Pop
> >>501 Swiss Jazz
> >
> >
> >awk -F':' ' { if (/^:/)  { print "\n" $2 ": " } else { print $1 } } '
> >channels.conf
> >
> >All in one line. This will produce one newline at the beginning, but I
> >don't care ;-)
> 
> You missed the channel numbering :
> 
> awk -F':' 'BEGIN{ num = 1; } { if (/^:/)  { print "\n" $2 ": "; num = $1 
> } else { print num, $1; num += 1 } } ' channels.conf
> 
> Untested, but the idea is here.

Ok, now it get's funny ;-)
My channels.conf doesn't include the @, so here's a version, that numbers
the channels correctly with and without @ (hopefully):

awk -F':' ' BEGIN { num = 1 } { if (/^:/)  { if ($2 ~ /^@/)
{ FS=" "; $0=$2; print "\n" $2 ": "; num = substr($1,2);}
else {print "\n" $2 ": " }; FS=":"} else { print num " " $1; num+=1} }'
channels.conf

again, all in one line ;)
-- 
Matthias.Mueller@rz.uni-karlsruhe.de
Rechenzentrum Universitaet Karlsruhe
Abteilung Netze




Home | Main Index | Thread Index