I am adding below 2 columns into my existing CSV. Everything is working fine apart from the header name or column name I import this CSV into MongoDB later
Current CSV:
"US_Business_Email_Data_01","AL"
"US_Business_Email_Data_01","AL"
Required CSV:
"FolderName","FileName"
"US_Business_Email_Data_01","AL"
Additional Information:
When converted to JSON in mongodb Current document:
{
"US_Business_Email_Data_01" : "US_Business_Email_Data_01",
"AL" : "AL"
}
When converted to JSON in mongodb Required document:
{
"FolderName" : "US_Business_Email_Data_01",
"FileName" : "AL"
}
My Bash Script:
Sed in my bash script is the following.
x=$zip_folder_name;y=$csv_name_updated; sed "s/$/,$x,$y/g" ${inner_file} > updated.csv
mv updated.csv ${inner_file}
Please Help Thanks in advance!
jqwith your JSON file.