read cvs file in bash
a small but useful snippet to read a csv file from in a bash script
#!/bin/bash
while IFS=, read -r column1 column2 column3 # delimiter is ,
do
echo "$column1|$column2|$column3"
done < file.csv
a small but useful snippet to read a csv file from in a bash script
#!/bin/bash
while IFS=, read -r column1 column2 column3 # delimiter is ,
do
echo "$column1|$column2|$column3"
done < file.csv
| Comment | # This is a comment in a bash file |
echo "Hello World!" |
|
| Arguments |
call the script like yourscript.sh arg1 arg2 arg3
|
| if | if [ (condition) ] |
| FOR | for i in `seq 1 10`; # count from 1 to 10 |
| Exit | exit 0 |
| Get return code | echo $? |