- Export Asana tasks as csv
- convert to json (see cjParse.py
- Run through jq
- Run through sed and awk $ cat ~/Documents/BrainDump.json | jq -r '.[1,2]' { "Task ID": "38330760681093", "Created At": "2015-06-18", "Completed At": "", "Last Modified": "2022-04-15", "Name": "Sensu Client : remote server configuration setup", "Section/Column": "(no section)", "Assignee": "Jim Sander", "Assignee Email": "[email protected]", "Start Date": "", "Due Date": "", "Tags": "", "Notes": "", "Projects": "BrainDump,DCM-Sensu" } { "Task ID": "38874426003420", "Created At": "2015-06-23", "Completed At": "", "Last Modified": "2022-04-15", "Name": "Remote Monitor", "Section/Column": "(no section)", "Assignee": "Jim Sander", "Assignee Email": "[email protected]", "Start Date": "", "Due Date": "", "Tags": "", "Notes": "", "Projects": "BrainDump,DCM-Sensu" }
$ cat ~/Documents/BrainDump.json | jq -r '.[]|.Name,.Projects' | head -4 Sensu Check: Client Keepalive BrainDump,DCM-Sensu Sensu Client : remote server configuration setup BrainDump,DCM-Sensu
$ cat ~/Documents/BrainDump.json | jq '.[]| @sh "(.Name) (.Projects)"' | head -2 "'Sensu Check: Client Keepalive' 'BrainDump,DCM-Sensu'" "'Sensu Client : remote server configuration setup' 'BrainDump,DCM-Sensu'"
cat ~/Documents/BrainDump.json | jq '.[]| @sh "\(.Name)___\(.Projects)"' | sed "s/^\"'//" | sed "s/'\"$//" | sed "s/'___'/___/" | sed "s/ ___/___/" | awk -F'___' '{ pro=""; split($2,p,","); for (i in p){ pro=sprintf("pro:%s %s",p[i],pro) };
printf("task add %s %s\n", $1, pro ) }' | head -3
task add Sensu Check: Client Keepalive pro:BrainDump pro:DCM-Sensu task add Sensu Client : remote server configuration setup pro:BrainDump pro:DCM-Sensu task add Remote Monitor pro:BrainDump pro:DCM-Sensu