#!/bin/bash

## Strips time information from RDS samples.
##
## Input must be in RDS Spy (hex group) format. Illegal input will cause the script to behave in an unpredictable way.
##
## This script will strip time-related information from the file. This currently includes:
## - Timestamp metadata for individual RDS blocks (added by some RDS tools)
## - 4A groups, which carry Clock Time (CT) information
## - Station change metadata, which include a timestamp (added by some RDS tools)
##
## Output is written to stdout but can be redirected to a file or different program.
##
## Usage:
## striprdstime <infile>

cat "$1" | sed 's/^\(.... .... .... ....\).*/\1/' | grep -v '^.... 4[0-7].. .... ....' | grep -v '^%.* date=.*'
