#!/bin/sh # Format Blocket.se search results # Convert json to mbox jq -r '.data[] | "From BLOCKET " + (.list_time | sub("\\+[0-9][0-9]:00$"; "Z") | fromdate | strftime("%a %b %e %T %Y")) + "\n" + "From: " + .advertiser.name + ", " + .location[0].name + " (" + .advertiser.type + ")\n" + "Subject: " + "(" + (.price.value | tostring) + ") " + .subject + "\n" + # (.images[] | "X-Image: " + .url + "\n") + ([.images[].url] | map("X-Image: " + .) | join("\n")) + "\n" + "\n" + .body + "\n" + "\n" '