#!/bin/bash

# Usage: ./split_csv.sh input.csv output_col1.txt output_col2.txt

if [ "$#" -ne 3 ]; then
    echo "Usage: $0 <input.csv> <output_col1.txt> <output_col2.txt>"
    exit 1
fi

input_file="$1"
output1="$2"
output2="$3"

# Extract first column (everything before first comma)
cut -d',' -f1 "$input_file" > "$output1"

# Extract second column (everything after first comma)
cut -d',' -f2- "$input_file" > "$output2"

echo "Split complete: $output1 (column 1), $output2 (column 2)"
