I want to sort my channel list in my enigma2 dreambox using bash. The file looks like this:
#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/1/new.aviM
#DESCRIPTION new 5[EN]
#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/11/all2.mkvM
#DESCRIPTION all 2 [EN]
#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/movie3.mp4M
#DESCRIPTION movie 3 [EN]
As you can see in the file, each channel consists of two lines. I want to sort two lines each time in bash.
The result should look like this:
#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/11/all2.mkvM
#DESCRIPTION all 2 [EN]
#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/movie3.mp4M
#DESCRIPTION movie 3 [EN]
#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/1/new.aviM
#DESCRIPTION new 5[EN]
First one is all 2 [EN]
with the SERVICE
above it.
Second is movie movie 3 [EN]
with the SERVICE
above it.
Third is movie new 5[EN]
with SERVICE
above it.
I am now using a loop and this is very slow. I think this can be done faster using bash
Possible solution could be, For example:
Combine each two lines to one line. Second line needs to be the first and append the above line to it. Result should look like this:
#DESCRIPTION new 5[EN]#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/1/new.aviM #DESCRIPTION all 2 [EN]#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/11/all2.mkvM #DESCRIPTION movie 3 [EN]#SERVICE 4097:0:1:0:0:0:0:0:0:0:http%3A//server.com/movie/movie3.mp4M
Sort
- Create two lines again.