#!/bin/bash

if [ "$#" -ne 2 ]; then
    echo "Usage: ./latex_transform.sh <input_file.tex> <output_file.tex>"
    exit 1
fi

input_file=$1
output_file=$2

# First, transform subsections
sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+) (.*)/\\subsection{\2}/' $input_file > $output_file

# Then, transform sections (note the use of `-i` to modify the output file in place)
sed -i -E 's/^([0-9]+\.[0-9]+) (.*)/\\section{\2}/' $output_file

