Bag-cat » History » Version 3

Version 2 (J. Moringen, 09/25/2011 01:26 PM) → Version 3/10 (J. Moringen, 11/24/2011 03:01 PM)

h1. @bag-cat@

{{>toc}}

h2. Introduction

Like UNIX @cat@, the @bag-cat@ program makes a stream of data available on its standard output stream. Unlike UNIX @cat@, the data is obtained by processing log files.

See [[Bag-record|bag-record]] for recording and [[Bag-play|bag-play]] for replaying events from log files.

h2. Obtaining @bag-cat@

Binaries of the @bag-cat@ program can be downloaded from the "continuous integration server":http://ci.cor-lab.org for versions 0.4 and 0.5 of the project:rsb:

_@bag-cat@ is not available in the 0.4 version_ * "0.4 Linux i686":https://ci.cor-lab.de/job/cl-rsbag-tools-stable/label=ubuntu_lucid_32bit/
* "0.4 Linux x86_64":https://ci.cor-lab.de/job/cl-rsbag-tools-stable/label=ubuntu_lucid_64bit/


* "0.5 Linux i686":https://ci.cor-lab.de/job/rsbag-tools-cl-0.5/label=ubuntu_lucid_32bit/ i686":https://ci.cor-lab.de/job/cl-rsbag-tools/label=ubuntu_lucid_32bit/
* "0.5 Linux x86_64":https://ci.cor-lab.de/job/rsbag-tools-cl-0.5/label=ubuntu_lucid_64bit/ x86_64":https://ci.cor-lab.de/job/cl-rsbag-tools/label=ubuntu_lucid_64bit/
* "0.5 MacOS x86_64":https://ci.cor-lab.de/job/rsbag-tools-cl-0.5/label=MAC_OS_lion_64bit/ x86_64":https://ci.cor-lab.de/job/cl-rsbag-tools/label=MAC_OS_lion_64bit/

After the download, the @bag-cat@ file has to be made executable in most cases. This can be done for example by executing
<pre>
chmod +x bag-cat
</pre>
in the download directory.

h2. Checking Versions and Displaying Help

Version and help information is displayed when the @--version@ and @--help[-for all]@ @--help[-all]@ commandline options are specified:
<pre>
./bag-cat --version
./bag-cat --help
./bag-cat --help-for all --help-all
</pre>

The output of @--help[-for all]@ @--help[-all]@ includes a list of supported file formats.

h2. Printing the Contents of Log Files

When invoked with a log file, @bag-cat@ prints the contents of one or more channels to its standard output stream. This is probably most useful for channels containing textual data, since binary content usually requires a form of decoding.

Example:
<pre>
./bag-cat isr.tide | head
<sr db_start="80" db_utt="80" />
<sr db_start="45" db_utt="46" />
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><speech_hyp [...]
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><speech_hyp [...]
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><speech_hyp [...]
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><speech_hyp [...]
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><speech_hyp [...]
<speech_hyp xmlns:bxml="http://www.sleepycat.com/2002/dbxml" [...]
<TIMESTAMP>1290275288296</TIMESTAMP>
</pre>

h3. Selecting Channels for Playback

The default behavior of @bag-cat@ is to print the contents of all channels found in the given file. However, when only a subset of the recorded channels should be printed, the @--channel@ (@-c@) commandline option can be used to select channels. The following example prints the contents all channels matching one of the regular expressions "hyp" and "param".

<pre>
./bag-cat -c 'hyp' -c 'param' /tmp/nao.tide
</pre>

h3. Caveats

* Individual entries can no longer be distinguished (unless some in-band properties permit this)
* If multiple channels are printed, the channel from which a given part of the output originated is no longer apparent (unless some in-band properties allow determining this)
* Printing channels which contain binary to a terminal content may mess up the terminal and cause all sorts of mayhem