within single directory have series of data files timestamp appended filename, such file-13-57-38-876.txt, file-13-57-59-288.txt, file-13-58-19-700.txt, etc. time listed hour-minute-second-millisecond. each file formatted follows:
some preamble text takes few lines 0.000 1.000 0.200 0.900 0.400 0.800 0.600 0.700 0.800 0.600 1.000 0.500 each file contains points @ same x-coordinates, i'd concatenate data (probably using join) files single file alldata.txt containing many columns, 1 each file in order. stripping non-numerical data should straightforward using sed -i '/^[0-9]/ !d' *.txt, i'm not sure of easiest way troll through these files, joining them along way, due irregularities in timestamps in names. there way pass these files join one-by-one based on appearance 'alphabetically' within directory?
if input files regular - same x-coords in same order - try bash process substitution , script re-invocations:
#!/bin/bash process() { exec sed -n '/^[0-9]/p' "$1"; } [ $# -eq 0 ] && exit [ $# -eq 1 ] && { process "$1"; exit; } fn="$1"; shift join <(process "$fn") <("$0" "$@") if above saved "join_em.sh", see how:
./join_em.sh file-*.txt works you.
maybe take care if you're dealing hundreds or thousands of input files.
Comments
Post a Comment