Skip to content

Instantly share code, notes, and snippets.

@simongcc
Created December 16, 2020 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simongcc/af3ec82de16c2ef9db6761f4b691cd64 to your computer and use it in GitHub Desktop.
Save simongcc/af3ec82de16c2ef9db6761f4b691cd64 to your computer and use it in GitHub Desktop.
Bash Reading CSV
#!/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