Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- awk -F' - |:[0-9]+/' '
- FILENAME=="f1" {
- if (/^#EXTINF/) chn=$NF
- if (/^http:/) chg2id[chn] = $NF
- next
- }
- { lines[FNR] = $0 }
- /^#SERVICE/ { servline = FNR; next }
- /^#DESCRIPTION/ {
- chn = substr($0,14)
- gsub(/^ +| +$/, "", chn)
- if (chn) {
- sub( /^#SERVICE 1:(0:)+/, "#SERVICE " chg2id[chn], lines[servline])
- }
- next
- }
- END {
- for (i=1;i<=FNR;++i)
- print lines[i]
- }' f1 f2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement