<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=5294&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / [SOLVED] Locate cannot search for files with brackets?]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=5294</link>
		<description><![CDATA[The most recent posts in [SOLVED] Locate cannot search for files with brackets?.]]></description>
		<lastBuildDate>Thu, 03 Nov 2022 13:31:17 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] Locate cannot search for files with brackets?]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=38371#p38371</link>
			<description><![CDATA[<p>I did it with Lua. I use this script in my custom Thunar action called &quot;Locate elsewhere&quot; and it works perfectly now</p><div class="codebox"><pre><code>#!/usr/bin/lua
print(&quot;Other files with the same filename:&quot;)
for _,argument in ipairs(arg) do
        argument=string.gsub(argument,&quot;%[&quot;,&quot;\\[&quot;)
        print(&#039;locate -b &quot;&#039;..argument..&#039;&quot;&#039;)
        os.execute(&#039;locate -b &quot;&#039;..argument..&#039;&quot;&#039;)
end
print(&quot;Done.&quot;)
io.read()</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (Tritonio)]]></author>
			<pubDate>Thu, 03 Nov 2022 13:31:17 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=38371#p38371</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Locate cannot search for files with brackets?]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=38369#p38369</link>
			<description><![CDATA[<p>Thank you aluma! That&#039;s the solution to my problem. I&#039;ll need to find a way to do it programmaticaly with bash though since I&#039;m just passing filenames to this bash script that internally calls locate with them.</p><p>andyp67 indeed find is much more predictable with the exception of the -exec argument which took me some time to get used to.</p>]]></description>
			<author><![CDATA[dummy@example.com (Tritonio)]]></author>
			<pubDate>Thu, 03 Nov 2022 12:56:07 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=38369#p38369</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Locate cannot search for files with brackets?]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=38363#p38363</link>
			<description><![CDATA[<p>this may be off topic, bvut I did notice a message this morning with apt update, a </p><p>grep package went through and a notice was given, but I didn&#039;t read it all... But,</p><p>The note said something like &quot;grep has changed the escape key.. backslash, do I want to continue or use the old/new version.</p><p>hth GW</p>]]></description>
			<author><![CDATA[dummy@example.com (GlennW)]]></author>
			<pubDate>Thu, 03 Nov 2022 05:54:19 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=38363#p38363</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Locate cannot search for files with brackets?]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=38362#p38362</link>
			<description><![CDATA[<p>I am a user, not a programmer, for me it is &quot;dancing with a tambourine&quot;. <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />&quot;You can&#039;t use ] to mark the end of a range of characters. But if the range designator is preceded by /, then ] is the end of the range.&quot;<br />Example in the screenshot, after entering the first command with / nothing happens, but there is a file with square brackets next.<br />This property disappears after the computer is restarted.<br /><a href="https://postimages.org/" rel="nofollow"><span class="postimg"><img src="https://i.postimg.cc/nrfXyjhW/1.jpg" alt="1.jpg" /></span></a></p><p>Edit. <br />The 1.txt file on the desktop was specially renamed to 1[1].txt and the example is exactly the same file name.</p>]]></description>
			<author><![CDATA[dummy@example.com (aluma)]]></author>
			<pubDate>Thu, 03 Nov 2022 05:37:49 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=38362#p38362</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Locate cannot search for files with brackets?]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=38361#p38361</link>
			<description><![CDATA[<p>very intersting indeed<br />I just tried it and mlocate too, same<br />why locate is not tremendously popular is beyond me<br />I think the original find command is maybe your only hope<br />I have patiently learned some find command, I do think it does take some application of concentration but I found it to be straightforward when I tried<br />I wish you the very best, it&#039;s a fine endeavour</p>]]></description>
			<author><![CDATA[dummy@example.com (andyp67)]]></author>
			<pubDate>Thu, 03 Nov 2022 02:50:03 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=38361#p38361</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] Locate cannot search for files with brackets?]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=37939#p37939</link>
			<description><![CDATA[<p>This is driving me crazy. I am making a bash script that is given one or more files and will search with location for other locations that the same filename shows up. So I need to make this work given the whole filename. I intend to use this script as a custom Thunar action and it actually works fine for files that don&#039;t have square brackets in their name. But I have a file named:</p><div class="codebox"><pre><code>5481[2].jpg (image).html</code></pre></div><p>I want to use locate to search in what other locations it exists. Specifically </p><div class="codebox"><pre><code>locate -b &quot;(image).html&quot;</code></pre></div><p>will show the file, so the file is in my mlocate db. But trying to search with</p><div class="codebox"><pre><code>locate -b &quot;5481[2].jpg (image).html&quot; </code></pre></div><p>returns zero results!</p><p>Even leaving the bash script aside for a while and simply opening a terminal and typing &quot;locate&quot; then the start of the filename and tab completing it, which escapes the filename with backslashes, still returns zero results while it works for any other file without square brackets.</p><p>What gives? What&#039;s so special about these square brackets that locate refuses to use them in a search expression? The same issue applies to all my files with square brackets in their filenames.</p><p>My only other option would be to find a way to turn a filename into a regex and then user the regex mode of locate. Is there a command that I can filter a filename through to turn it into a proper regex?</p><p>Thank you.</p>]]></description>
			<author><![CDATA[dummy@example.com (Tritonio)]]></author>
			<pubDate>Fri, 14 Oct 2022 22:27:46 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=37939#p37939</guid>
		</item>
	</channel>
</rss>
