Created
December 8, 2023 07:46
-
-
Save steffenr/3f36990035f25d610fd2ac782a80d1d8 to your computer and use it in GitHub Desktop.
Convert .po to .csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if the required command-line argument is provided | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 <po_file>" | |
exit 1 | |
fi | |
po_file="$1" | |
csv_file="${po_file%.po}.csv" | |
# Convert PO file to CSV using awk | |
awk -F '"' '/msgid/ {msg=$2} /msgstr/ {print "\""msg"\",\"" $2 "\""}' "$po_file" > "$csv_file" | |
echo "Conversion complete. CSV file: $csv_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment