---
name: "tv_merge"
section: "1p"
platform: "linux"
package: "xmltv-util"
version: "1.4.0-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/tv_merge"
---

# tv\_merge(1p)

Merge (combine) two XMLTV files.

## NAME

tv\_merge - Merge (combine) two XMLTV files.

## SYNOPSIS

tv\_merge \[-t\] -i FILE -m FILE -o FILE

## DESCRIPTION

Read XMLTV listings from two files and merge them together. Unlike tv\_cat (which just joins files) this will update (add/replace/delete) the original XMLTV file with channels and programmes contained in the second file.

It works with multiple channels, and will insert any new programmes and delete any overlapping programmes.

**IMPORTANT** The input files must be pre-sorted into datetime within channel order by using the "--by-channel" option to tv\_sort:

```
  tv_sort --by-channel --output FILE FILE
```

All programmes must have start and stop times.

(Note: programmes in the merged-in file *replace* any in the master file, i.e. data are not updated *within* programmes)

This program uses XML::TreePP which doesn't write \<DOCTYPE\> definitions in the output file. If you need to add a suitable \<DOCTYPE\> tag then use the optional -t parameter:

```
  tv_merge -t -i FILE -m FILE -o FILE
```

## EXAMPLE

To merge all channels/programmes in *newadditions.xml* into *master.xml*, and write the output to *newmaster.xml* with a DOCTYPE tag:

```
  tv_merge -t -i master.xml -m newadditions.xml -o newmaster.xml
```

## SEE ALSO

**tv\_sort**(1), **XMLTV**(3)

## AUTHOR

Copyright Geoff Westcott, February 2013.

This code is distributed under the GNU General Public License v2 (GPLv2).
