#! /bin/sh # Cleans src from CSV file exported by MOR/M2 # "123456789" <123456789> ----> 123456789 # "987654321" <123456789> ----> 123456789 # "\"123456789\" <123456789>" -- > "123456789" # "\"987654321\" <123456789>" -- > "123456789" csv_file="$1" if [ -n "$csv_file" ] && [ -e "$csv_file" ]; then # Before modifying Backup file will be created csv_file.bak perl -pi.bak -e 's#(?:\"\K\\)?\"(\d+)(?:\\)?\"\s+<(\d+)>#\2#g' "$csv_file" else exit 1 fi