cloudy-agn/scripts/file/split_grid_output_linear.sh
2017-08-07 21:35:13 -04:00

32 lines
645 B
Bash
Executable File

#!/bin/bash
cloudy_output=$1
grid_delimits=`grep -n 'GRID_DELIMIT' $cloudy_output|sed 's#^\([0-9]*\):.*$#\1 #'`
echo Information Captured
echo ====================
echo scanning cloudy output file $cloudy_output
echo grid_delimits: $grid_delimits
grid_number=0
interval_origin=0
for line_number in $grid_delimits; do
if [[ $interval_origin == 0 ]]; then
interval_origin=$line_number
continue
fi
tmpfile=tmp.out.$grid_number
touch $tmpfile
echo lines $interval_origin to $line_number to file $tmpfile
sed -n ${interval_origin},${line_number}p $cloudy_output >> $tmpfile
interval_origin=$line_number
(( grid_number++ ))
done