Skip to main content

Posts

Showing posts from August, 2015

Extracting a single field from a very long json file

Trivial task, but still can save some time to somebody, so I am gladly sharing.
A friend of a mine has an huge json file, and she had to extract all unique value for a field called "title".  The file was too big to be processed from a notepad or an excel.

With those comands, I was able to obtain a clean, unique and sorted list list of all the content.


grep -o -E '"title":"[^"]+",' tmp.json | sort |uniq > output.txt
sed -i 's/"title":"//g' output.txt
sed -i 's/",//g' output.txt