Skip to content

Instantly share code, notes, and snippets.

@simongcc

simongcc/read-csv.sh

Created Dec 16, 2020
Embed
What would you like to do?
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