i have shell script which is producing multiple output
for example
#/bin/bash
var1=`cat test.json | grep "test" | awk -F ' ' '{print $1}'`
var2=`cat test.json | grep -e "new" | awk -F ':' '{print$5}'`
var3=`cat test.json | grep -e "new-test" | awk -F ':' '{print$8}'`
echo $var1,var2,var3
output of the first var1 is
1
2
3
4
5
output of the first var2 is
3
4
5
6
7
output of the first var3 is
834
45
345
73
23
how do I create a csv file with the following format?
1,3,834
2,4,45
3,5,345
4,6,73
5,7,23
test.jsonusing regex to parse json is not recommended.cat foo | grep "bar"withgrep "bar" foo.catis for concatenation, not for printing.