Skip to content

Instantly share code, notes, and snippets.

@ablwr

ablwr/make_json.sh

Created May 14, 2020
Embed
What would you like to do?
make_json.sh
#!/bin/bash
printf '['
#
LC_ALL=C
for i in $(find ocrarchive/ -iname '*.txt');
do
printf '{"title":"'
printf "$i"
printf '","url":"'
printf "$i"
printf '","body":"'
cat -v "$i" | tr -cd '\11\12\15\40-\176' | tr -dc '\0-\177' | tr '\n' ' ' | tr '^+=%<>:\\#%|?*' ' ' | sed 's/"//g'
printf '"}\n,\n'
done
printf ']\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.