blob: 2dbc67e87144a5614df68596b74b72d3f8f40e90 (
plain) (
blame)
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
|
#!/bin/sh
# Prepare all waveform data for MATLAB processing.
#
# This script will:
# 1. sanitise the header before running MATLAB's readtable();
# 2. convert line endings from DOS to UNIX; and
# 3. rename files to have *.tsv file extensions.
#
# This script assumes all waveform data is tab-delimited and
# stored in *.txt files.
#
# Usage: ./prep.sh
files=$(ls -- *.txt)
for i in $files; do
printf "Preparing %s\n" "$i"
# Replace the header and convert DOS line endings (CRLF)
# to UNIX line endings (LF).
sed -i -e "1c time\tv1\tv2\tv3\ti1\ti2\ti3" -e "s/\x1D$//" "$i"
# Rename files to have TSV extensions.
mv "$i" "${i%.*}.tsv"
done
|