Convert CSV to JSON using bash. Here’s the output of the above script: Ubuntu Linux Mint Debian Arch Fedora Method 2: Split string using tr command in Bash. Execute the script. Method 3: Bash split string into array using delimiter. Convert String to an Array using shell scripting in JSON file. 2) Set up options: parse numbers, transpose your data, or output an object instead of an array. bash shell variable array. /** * Convert a comma separated file into an associated array. We can combine read with IFS (Internal Field Separator) to … Posted - Mon, Jan 20, 2020 11:13 AM. Note: The code uses the first row of your CSV data to determine the keys in the associative array. Click here for a thorough lesson about bash and using arrays in bash. Simply (re)define the IFS variable to the delimiter character and assign the values to a new variable using the array=($ ) syntax. There are numerous libraries and code … Now you can access the array to get any word you desire or use the for loop in bash to print all the words one by one as I have done in the above script. For example "" has to … ... create array $(