Leggere un file CSV in bash: Difference between revisions
Jump to navigation
Jump to search
Created page with "Ecco un esempio: <pre> #!/bin/bash # Purpose: Read Comma Separated CSV File # Author: Vivek Gite under GPL v2.0+ # ------------------------------------------ INPUT=data.cvs O..." |
(No difference)
|
Latest revision as of 15:09, 3 March 2020
Ecco un esempio:
#!/bin/bash
# Purpose: Read Comma Separated CSV File
# Author: Vivek Gite under GPL v2.0+
# ------------------------------------------
INPUT=data.cvs
OLDIFS=$IFS
IFS=','
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read flname dob ssn tel status
do
echo "Name : $flname"
echo "DOB : $dob"
echo "SSN : $ssn"
echo "Telephone : $tel"
echo "Status : $status"
done < $INPUT
IFS=$OLDIFS