Created
December 16, 2020 04:41
-
-
Save simongcc/af3ec82de16c2ef9db6761f4b691cd64 to your computer and use it in GitHub Desktop.
Bash Reading CSV
This file contains 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 | |
# Purpose: Read Comma Separated CSV File | |
# Author: Vivek Gite under GPL v2.0+ | |
# Site: https://www.cyberciti.biz/faq/unix-linux-bash-read-comma-separated-cvsfile/ | |
# ------------------------------------------ | |
INPUT=bridge-category.csv | |
OLDIFS=$IFS | |
IFS=',' | |
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } | |
while read cat_en cat_zht | |
do | |
echo "Category English : $cat_en" | |
echo "Category Traditional Chinese : $cat_zht" | |
done < $INPUT | |
IFS=$OLDIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment