#!/bin/bash # Check if the input file path and URL are provided if [ -z "$1" ] || [ -z "$2" ]; then echo "Usage: $0 " exit 1 fi # Input parameters file_path="$1" file_url="$2" # Check if the input file exists if [ ! -f "$file_path" ]; then echo "Error: File '$file_path' not found!" exit 1 fi # Generate the output TSV filename by removing .csv extension and appending .tsv output_tsv="${file_path%.csv}.tsv" # Generate the TSV header echo "TsvHttpData-1.0" > "$output_tsv" # Get the file size in bytes file_size=$(stat -c%s "$file_path") # Calculate the MD5 checksum and encode it in Base64 file_md5=$(md5sum "$file_path" | awk '{print $1}' | xxd -r -p | base64) # Write the TSV content to the output file echo -e "$file_url\t$file_size\t$file_md5" >> "$output_tsv" echo "TSV file '$output_tsv' created successfully."