script

mail@pastecode.io avatar
unknown
sh
5 months ago
497 B
4
Indexable
#!/bin/bash

output_file="results.txt"
header="sim, grid, Tcells, DCs, obstacles, seed, number of contacts"

if [ "$#" -eq 1 ]; then
    output_file="$1"
    add_header=false
else
    output_file="$output_file"
    add_header=true
fi

if [ "$add_header" = true ]; then
    echo "$header" > "$output_file"
else
    touch "$output_file"
fi

for file in *; do
    if [ -f "$file" ] && [ "$file" != "$output_file" ]; then
        tail -n +2 "$file" >> "$output_file"
    fi
done
Leave a Comment