1
0
mirror of https://github.com/balkian/bitter.git synced 2024-12-22 08:28:12 +00:00
bitter/bin/extract_text.sh
J. Fernando Sánchez 53bb7edabc Add sh scripts
2018-03-19 14:35:07 +01:00

17 lines
350 B
Bash
Executable File

if [ "$#" -lt 1 ]
then
echo "Usage: $0 <files to convert>"
exit 1
fi
QUERY='(.full_text // .retweeted_status.full_text) as $text | [ .id_str,$text ] | @csv'
HEADER='id,text'
for i in "$@"
do
OUTPUT=$i.text.csv
echo $HEADER > $OUTPUT
pv -l -N "$i" $i | jq -r "$QUERY" >> $OUTPUT
# sed -ri s/^"([0-9]+),\\"(.*)\\""$/"\1","\2"/g $OUTPUT
done