buoy_number="42002" | |
input_file="${buoy_number}_XXXX.txt" | |
output_file="csv/${buoy_number}_XXXX.csv" | |
for value in {1980..2022} | |
do | |
sed -e 's/\s\+/,/g' ${input_file/XXXX/$value} > ${output_file/XXXX/$value} | |
#echo "${url//XXXX/"$value"}" | |
#line=$(head -n 1 ${input_file/XXXX/$value}) | |
#line_count=$(wc -l ${input_file/XXXX/$value}) | |
#echo "$value $line_count $line" | |
echo "done" | |
done | |
# Now do 2023 - just grab all teh files in 2023 and convert them into the interior CSV directory | |
for FILE in 2023/*.txt; | |
do | |
filename=${FILE%.*} | |
new_filename=2023/csv/${filename#*/}.csv | |
# remove whitespace on the end | |
sed 's/ *$//' file | |
# change all spaces to commas, repeating spaces only get 1 comma | |
sed -e 's/\s\+/,/g' ${FILE} > ${new_filename} | |
done |