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.
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
Comments
sed -n "s/^.*\"title\":\"\([^\"]*\)\",.*/\1/p" tmp.json | uniq | sort > output.txt