1
0
mirror of https://github.com/balkian/bitter.git synced 2024-12-22 16:38:13 +00:00
bitter/bin/extract_text.sh

17 lines
350 B
Bash
Raw Normal View History

2018-03-19 13:35:07 +00:00
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