Danke ... Leider habe ich hierzu noch nichts gefunden (ehrlich gesagt auch noch nicht richtig gesucht). Aber wenn ich euch richtig verstehe dann bezieht sich -k 1 auf den Anfang und -k 2 auf den ersten Tabulator und -k 2.3 auf das dritte Zeichen nach dem ersten Tabulator ?
Habe noch ein wenig gebastelt und bin wieder etwas am verzweifeln ...
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 | #!/bin/bash # Sortierung sort --key=1.80 Datei4.txt > Datei_xx.txt # Aufbereitung a=0 while read zeile; do a=$(($a+1)) done < Datei_x1.txt echo "Ausgegeben werden $a Einträge" b=$(($a/5)) echo "Anzahl Blöcke $b plus rest" echo "===========================================================================================================================" echo "Lft# Verzeichnis Sender Film Aufnahme zeit und Datum" echo "===========================================================================================================================" c=0 d1=0 bb=$(($b)) for ((c;c<=bb*5;c)); do c=$(($c+1)); d1=$(($c)) printf "%04d $c "; cat Datei_x1.txt | head -$d1 | tail -1 c=$(($c+1)); d1=$(($c)) printf "%04d $c "; cat Datei_x1.txt | head -$d1 | tail -1 c=$(($c+1)); d1=$(($c)) printf "%04d $c "; cat Datei_x1.txt | head -$d1 | tail -1 c=$(($c+1)); d1=$(($c)) printf "%04d $c "; cat Datei_x1.txt | head -$d1 | tail -1 c=$(($c+1)); d1=$(($c)) printf "%04d $c "; cat Datei_x1.txt | head -$d1 | tail -1 echo "---------------------------------------------------------------------------------------------------------------------------" done |
Ausgegeben werden soll 4 Stellig eine fortlaufende Nummer. Dann untereinander REC.... und der Rest. Außerdem ist die letzte Zeile doppelt. Ja, natürlich dann alles in eine Datei. (nur so war das testen einfacher)
Raus kommt dabei keine Ahnung was ich wieder falsch mache (und darunter zu kopiert die Ausgangsdatei Datei_x1.txt):
Ausgegeben werden 14 Einträge Anzahl Blöcke 2 plus rest =========================================================================================================================== Lft# Verzeichnis Sender Film Aufnahme zeit und Datum =========================================================================================================================== 0000 1 REC_0280 ProSieben MAXX EUReKA - Die geheime Stadt 1 date: 2016-01-14 time: 16:46 (UTC) 0000 2 REC_0358 ProSieben MAXX EUReKA - Die geheime Stadt 2 date: 2016-01-15 time: 16:46 (UTC) 0000 3 REC_0043 SWR Fernsehen BW Eisenbahn-Romantik 3 date: 2016-06-03 time: 12:15 (UTC) 0000 4 REC_0095 SWR Fernsehen BW Eisenbahn-Romantik 4 date: 2016-06-04 time: 12:15 (UTC) 0000 5 REC_0127 SWR Fernsehen BW Eisenbahn-Romantik 5 date: 2016-06-07 time: 12:15 (UTC) --------------------------------------------------------------------------------------------------------------------------- 0000 6 REC_0147 SWR Fernsehen BW Eisenbahn-Romantik 6 date: 2016-06-14 time: 12:15 (UTC) 0000 7 REC_0131 SWR Fernsehen BW Eisenbahn-Romantik 7 date: 2016-06-18 time: 12:15 (UTC) 0000 8 REC_0044 SWR Fernsehen BW Eisenbahn-Romantik 8 date: 2016-06-19 time: 12:15 (UTC) 0000 9 REC_0250 SWR Fernsehen BW Eisenbahn-Romantik 9 date: 2016-06-20 time: 12:15 (UTC) 0000 10 REC_0030 SWR Fernsehen BW Eisenbahn-Romantik 10 date: 2016-06-21 time: 12:15 (UTC) --------------------------------------------------------------------------------------------------------------------------- 0000 11 REC_0141 SWR Fernsehen BW Eisenbahn-Romantik 11 date: 2016-06-27 time: 12:15 (UTC) 0000 12 REC_0041 SWR Fernsehen BW Eisenbahn-Romantik 12 date: 2016-06-28 time: 12:15 (UTC) 0000 13 REC_0003 SWR Fernsehen BW Eisenbahn-Romantik 13 date: 2016-06-29 time: 12:15 (UTC) 0000 14 REC_0067 SWR Fernsehen BW Eisenbahn-Romantik ende 14 date: 2016-07-01 time: 12:15 (UTC) 0000 15 REC_0067 SWR Fernsehen BW Eisenbahn-Romantik ende 14 date: 2016-07-01 time: 12:15 (UTC) --------------------------------------------------------------------------------------------------------------------------- Datei_x1.txt REC_0280 ProSieben MAXX EUReKA - Die geheime Stadt 1 date: 2016-01-14 time: 16:46 (UTC) REC_0358 ProSieben MAXX EUReKA - Die geheime Stadt 2 date: 2016-01-15 time: 16:46 (UTC) REC_0043 SWR Fernsehen BW Eisenbahn-Romantik 3 date: 2016-06-03 time: 12:15 (UTC) REC_0095 SWR Fernsehen BW Eisenbahn-Romantik 4 date: 2016-06-04 time: 12:15 (UTC) REC_0127 SWR Fernsehen BW Eisenbahn-Romantik 5 date: 2016-06-07 time: 12:15 (UTC) REC_0147 SWR Fernsehen BW Eisenbahn-Romantik 6 date: 2016-06-14 time: 12:15 (UTC) REC_0131 SWR Fernsehen BW Eisenbahn-Romantik 7 date: 2016-06-18 time: 12:15 (UTC) REC_0044 SWR Fernsehen BW Eisenbahn-Romantik 8 date: 2016-06-19 time: 12:15 (UTC) REC_0250 SWR Fernsehen BW Eisenbahn-Romantik 9 date: 2016-06-20 time: 12:15 (UTC) REC_0030 SWR Fernsehen BW Eisenbahn-Romantik 10 date: 2016-06-21 time: 12:15 (UTC) REC_0141 SWR Fernsehen BW Eisenbahn-Romantik 11 date: 2016-06-27 time: 12:15 (UTC) REC_0041 SWR Fernsehen BW Eisenbahn-Romantik 12 date: 2016-06-28 time: 12:15 (UTC) REC_0003 SWR Fernsehen BW Eisenbahn-Romantik 13 date: 2016-06-29 time: 12:15 (UTC) REC_0067 SWR Fernsehen BW Eisenbahn-Romantik ende 14 date: 2016-07-01 time: 12:15 (UTC)
Wenn jemand mag ... würde gern noch die Film Länge mit dem C-Programm auslesen.
Gruß Jochen