<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Search_for_string_in_json_files</id>
	<title>Search for string in json files - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Search_for_string_in_json_files"/>
	<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Search_for_string_in_json_files&amp;action=history"/>
	<updated>2026-04-23T20:04:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Search_for_string_in_json_files&amp;diff=22215&amp;oldid=prev</id>
		<title>Unknown user: /* Approach 2: The specified index/column contains the keyword(s) */</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Search_for_string_in_json_files&amp;diff=22215&amp;oldid=prev"/>
		<updated>2021-03-09T11:38:39Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Approach 2: The specified index/column contains the keyword(s)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:38, 9 March 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Output: file name and the value of specified index/column&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Output: file name and the value of specified index/column&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Command 1: {{kbd | key=&amp;lt;nowiki&amp;gt;find . -name &amp;#039;*.json&amp;#039; | xargs -I {} jq &amp;#039;{&amp;quot;file&amp;quot;: input_filename, &amp;quot;MYCOLUMN&amp;quot;: ..|.MYCOLUMN?}&amp;#039; {} | jq -c &amp;#039;select(.MYCOLUMN | contains(&amp;quot;詐騙&amp;quot;))&amp;#039;&amp;lt;/nowiki&amp;gt;}} to find json files which content of column {{kbd | key=MYCOLUMN}} contains the string {{kbd | key=&amp;lt;nowiki&amp;gt;詐騙&amp;lt;/nowiki&amp;gt;}}&amp;lt;ref&amp;gt;[https://medium.com/@marvinirwin/bash-snippet-find-every-file-containing-a-non-empty-array-value-with-find-xargs-and-jq-cc456d3705e4 bash snippet: Find every file containing a non empty array value with find, xargs, and jq | by Marvin Irwin | Medium]&amp;lt;/ref&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Command 1: {{kbd | key=&amp;lt;nowiki&amp;gt;find . -name &amp;#039;*.json&amp;#039; | xargs -I {} jq &amp;#039;{&amp;quot;file&amp;quot;: input_filename, &amp;quot;MYCOLUMN&amp;quot;: ..|.MYCOLUMN?}&amp;#039; {} | jq -c &amp;#039;select(.MYCOLUMN | contains(&amp;quot;詐騙&amp;quot;))&amp;#039;&amp;lt;/nowiki&amp;gt;}} to find json files which content of column {{kbd | key=MYCOLUMN}} contains the string {{kbd | key=&amp;lt;nowiki&amp;gt;詐騙&amp;lt;/nowiki&amp;gt;}}&amp;lt;ref&amp;gt;[https://medium.com/@marvinirwin/bash-snippet-find-every-file-containing-a-non-empty-array-value-with-find-xargs-and-jq-cc456d3705e4 bash snippet: Find every file containing a non empty array value with find, xargs, and jq | by Marvin Irwin | Medium]&amp;lt;/ref&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Command 2: {{kbd | key=&amp;lt;nowiki&amp;gt;find . -name &amp;#039;*.json&amp;#039; | xargs -I {} jq &amp;#039;{&amp;quot;file&amp;quot;: input_filename, &amp;quot;MYCOLUMN&amp;quot;: ..|.MYCOLUMN?}&amp;#039; {} | jq -c &amp;#039;select(.MYCOLUMN | contains(&amp;quot;詐騙&amp;quot;) or contains(&amp;quot;詐欺&amp;quot;))&amp;#039;&amp;lt;/nowiki&amp;gt;}} to find json files which content of column {{kbd | key=MYCOLUMN}} contains the string {{kbd | key=&amp;lt;nowiki&amp;gt;詐騙&amp;lt;/nowiki&amp;gt;}} or {{kbd | key=&amp;lt;nowiki&amp;gt;詐欺&amp;lt;/nowiki&amp;gt;}}.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Command 2 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;for multiple keywords using boolean OR operator&lt;/ins&gt;: {{kbd | key=&amp;lt;nowiki&amp;gt;find . -name &amp;#039;*.json&amp;#039; | xargs -I {} jq &amp;#039;{&amp;quot;file&amp;quot;: input_filename, &amp;quot;MYCOLUMN&amp;quot;: ..|.MYCOLUMN?}&amp;#039; {} | jq -c &amp;#039;select(.MYCOLUMN | contains(&amp;quot;詐騙&amp;quot;) or contains(&amp;quot;詐欺&amp;quot;))&amp;#039;&amp;lt;/nowiki&amp;gt;}} to find json files which content of column {{kbd | key=MYCOLUMN}} contains the string {{kbd | key=&amp;lt;nowiki&amp;gt;詐騙&amp;lt;/nowiki&amp;gt;}} or {{kbd | key=&amp;lt;nowiki&amp;gt;詐欺&amp;lt;/nowiki&amp;gt;}}.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Command 3 for multiple keywords using boolean AND operator: {{kbd | key=&amp;lt;nowiki&amp;gt;find . -name &amp;#039;*.json&amp;#039; | xargs -I {} jq &amp;#039;{&amp;quot;file&amp;quot;: input_filename, &amp;quot;MYCOLUMN&amp;quot;: ..|.MYCOLUMN?}&amp;#039; {} | jq -c &amp;#039;select(.MYCOLUMN | contains(&amp;quot;詐騙&amp;quot;) and contains(&amp;quot;詐欺&amp;quot;))&amp;#039;&amp;lt;/nowiki&amp;gt;}} to find json files which content of column {{kbd | key=MYCOLUMN}} contains the string {{kbd | key=&amp;lt;nowiki&amp;gt;詐騙&amp;lt;/nowiki&amp;gt;}} and {{kbd | key=&amp;lt;nowiki&amp;gt;詐欺&amp;lt;/nowiki&amp;gt;}}.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== References ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== References ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Unknown user</name></author>
	</entry>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Search_for_string_in_json_files&amp;diff=22192&amp;oldid=prev</id>
		<title>Unknown user: Created page with &quot;Search for string in multiple JSON files  == Approaches == === Approach 1: Content of JSON file contains the keyword(s) === * Input: (1) Specify the folder path (2) Specify th...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Search_for_string_in_json_files&amp;diff=22192&amp;oldid=prev"/>
		<updated>2021-03-09T11:29:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Search for string in multiple JSON files  == Approaches == === Approach 1: Content of JSON file contains the keyword(s) === * Input: (1) Specify the folder path (2) Specify th...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Search for string in multiple JSON files&lt;br /&gt;
&lt;br /&gt;
== Approaches ==&lt;br /&gt;
=== Approach 1: Content of JSON file contains the keyword(s) ===&lt;br /&gt;
* Input: (1) Specify the folder path (2) Specify the keyword(s)&lt;br /&gt;
* Output: file name list&lt;br /&gt;
* Command: {{kbd | key=&amp;lt;nowiki&amp;gt;find *.json | xargs grep -E &amp;quot;詐騙|詐欺&amp;quot; -sl&amp;lt;/nowiki&amp;gt;}} to find json files which its content contains the string {{kbd | key=&amp;lt;nowiki&amp;gt;詐騙&amp;lt;/nowiki&amp;gt;}} or {{kbd | key=&amp;lt;nowiki&amp;gt;詐欺&amp;lt;/nowiki&amp;gt;}}.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Approach 2: The specified index/column contains the keyword(s) ===&lt;br /&gt;
* Requirement: Install [https://stedolan.github.io/jq/ jq]&lt;br /&gt;
* Input: (1) Specify the folder path (2) Specify the keyword(s) (3) Specify the index/column of JSON&lt;br /&gt;
* Output: file name and the value of specified index/column&lt;br /&gt;
* Command 1: {{kbd | key=&amp;lt;nowiki&amp;gt;find . -name &amp;#039;*.json&amp;#039; | xargs -I {} jq &amp;#039;{&amp;quot;file&amp;quot;: input_filename, &amp;quot;MYCOLUMN&amp;quot;: ..|.MYCOLUMN?}&amp;#039; {} | jq -c &amp;#039;select(.MYCOLUMN | contains(&amp;quot;詐騙&amp;quot;))&amp;#039;&amp;lt;/nowiki&amp;gt;}} to find json files which content of column {{kbd | key=MYCOLUMN}} contains the string {{kbd | key=&amp;lt;nowiki&amp;gt;詐騙&amp;lt;/nowiki&amp;gt;}}&amp;lt;ref&amp;gt;[https://medium.com/@marvinirwin/bash-snippet-find-every-file-containing-a-non-empty-array-value-with-find-xargs-and-jq-cc456d3705e4 bash snippet: Find every file containing a non empty array value with find, xargs, and jq | by Marvin Irwin | Medium]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Command 2: {{kbd | key=&amp;lt;nowiki&amp;gt;find . -name &amp;#039;*.json&amp;#039; | xargs -I {} jq &amp;#039;{&amp;quot;file&amp;quot;: input_filename, &amp;quot;MYCOLUMN&amp;quot;: ..|.MYCOLUMN?}&amp;#039; {} | jq -c &amp;#039;select(.MYCOLUMN | contains(&amp;quot;詐騙&amp;quot;) or contains(&amp;quot;詐欺&amp;quot;))&amp;#039;&amp;lt;/nowiki&amp;gt;}} to find json files which content of column {{kbd | key=MYCOLUMN}} contains the string {{kbd | key=&amp;lt;nowiki&amp;gt;詐騙&amp;lt;/nowiki&amp;gt;}} or {{kbd | key=&amp;lt;nowiki&amp;gt;詐欺&amp;lt;/nowiki&amp;gt;}}.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Search]] [[Category:Programming]] [[Category:String manipulation]]&lt;/div&gt;</summary>
		<author><name>Unknown user</name></author>
	</entry>
</feed>