From nobody Sat Feb 11 15:40:11 2023 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PDZYs1yb3z3pCrm for ; Sat, 11 Feb 2023 15:40:33 +0000 (UTC) (envelope-from 93ab.82.c3a300040cd758.558114b092f4f8d67c7477db6870ce3e@email-od.com) Received: from s1-b515.socketlabs.email-od.com (s1-b515.socketlabs.email-od.com [142.0.181.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PDZYr2ph9z3y0V for ; Sat, 11 Feb 2023 15:40:32 +0000 (UTC) (envelope-from 93ab.82.c3a300040cd758.558114b092f4f8d67c7477db6870ce3e@email-od.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tundraware.com header.s=slkey header.b=cptWwD9i; dkim=pass header.d=email-od.com header.s=dkim header.b=bgebhZ0c; spf=pass (mx1.freebsd.org: domain of 93ab.82.c3a300040cd758.558114b092f4f8d67c7477db6870ce3e@email-od.com designates 142.0.181.21 as permitted sender) smtp.mailfrom=93ab.82.c3a300040cd758.558114b092f4f8d67c7477db6870ce3e@email-od.com; dmarc=pass (policy=reject) header.from=tundraware.com DKIM-Signature: v=1; a=rsa-sha256; d=tundraware.com;s=slkey; c=relaxed/relaxed; q=dns/txt; t=1676130032; x=1678722032; h=x-tundraware-mailscanner-from:x-greylist:content-transfer-encoding:content-type:in-reply-to:from:content-language:references:to:subject:mime-version:date:message-id:x-thread-info:subject:to:from:cc:reply-to; bh=cdDAo3QxTlGF5tqZvzTz3zMtwZZr1vrYNhpC1FeO8V0=; b=cptWwD9iIAolXfgZSCcRzcngoH4f82KIozQVtK0F+DFfZgAHLtW3+kCphoX48w4gwytV7qFt0JFYWFScUvSN/nqYH5b4G156/8wMlzTkj302kvH0JUmi2xV3kW+Z8LZ9dX3Rpy/rmRSB6Ei7q055RVP2ZC68WzWcx6pe8QLOgUulaIK4pLDzhd9A5w60v0aYuobQRo77ZTaJbBjKZ6mXNaLd0eKpAP5JrxciBjWe8EMZ313lHBk/ap8sx+47k+nmEmjCjYjYR3bfXjPo/3xPxEbHxg14vwzan1eWbMArDTI27zrd1fh/BkoCalG0lDWhYfZqumGTjxUvjf65RY6KTA== DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1676130032; x=1678722032; h=x-tundraware-mailscanner-from:x-greylist:content-transfer-encoding:content-type:in-reply-to:from:content-language:references:to:subject:mime-version:date:message-id:x-thread-info:subject:to:from:cc:reply-to; bh=cdDAo3QxTlGF5tqZvzTz3zMtwZZr1vrYNhpC1FeO8V0=; b=bgebhZ0cN12kZi8UlNXfD3nUoLLtF/fHTqPXg0cUuuco4PzySS+hNXCnRCCE0jdB608o2gqRkpurcYnXLK+l6umRS5qHLtNeGjX3TFD9Yk35Jas18WtcCYHXHMVUrEUgmxiI3Hs850XvFWbcv4xE4+4FP30bOFllfK1lR16QNZQ= X-Thread-Info: OTNhYi4xMi5jM2EzMDAwNDBjZDc1OC5mcmVlYnNkLXF1ZXN0aW9ucz1mcmVlYnNkLm9yZw== Received: from r1.us-east-1.aws.in.socketlabs.com (r1.us-east-1.aws.in.socketlabs.com [142.0.191.1]) by mxh4.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Sat, 11 Feb 2023 10:40:27 -0500 Received: from oceanview.tundraware.com (oceanview.tundraware.com [45.55.60.57]) by r1.us-east-1.aws.in.socketlabs.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Sat, 11 Feb 2023 10:40:26 -0500 Received: from [192.168.0.2] (ozzie.tundraware.com [75.145.138.73]) (authenticated bits=0) by oceanview.tundraware.com (8.17.1/8.17.1) with ESMTPSA id 31BFeGOr067593 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO) for ; Sat, 11 Feb 2023 09:40:16 -0600 (CST) (envelope-from tundra@tundraware.com) Message-ID: Date: Sat, 11 Feb 2023 09:40:11 -0600 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: remove double quote character from file names To: FreeBSD Mailing List References: Content-Language: en-US From: Tim Daneliuk In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (oceanview.tundraware.com [45.55.60.57]); Sat, 11 Feb 2023 09:40:16 -0600 (CST) X-TundraWare-MailScanner-Information: Please contact the ISP for more information X-TundraWare-MailScanner-ID: 31BFeGOr067593 X-TundraWare-MailScanner: Found to be clean X-TundraWare-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (not cached, score=-4.048, required 6, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90, NICE_REPLY_A -1.15) X-TundraWare-MailScanner-From: tundra@tundraware.com X-Spam-Status: No X-Spamd-Result: default: False [-3.70 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; DMARC_POLICY_ALLOW(-0.50)[tundraware.com,reject]; FORGED_SENDER(0.30)[tundra@tundraware.com,93ab.82.c3a300040cd758.558114b092f4f8d67c7477db6870ce3e@email-od.com]; R_DKIM_ALLOW(-0.20)[tundraware.com:s=slkey,email-od.com:s=dkim]; R_SPF_ALLOW(-0.20)[+ip4:142.0.176.0/20]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[tundra@tundraware.com,93ab.82.c3a300040cd758.558114b092f4f8d67c7477db6870ce3e@email-od.com]; RCVD_IN_DNSWL_NONE(0.00)[142.0.181.21:from,142.0.191.1:received]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:53658, ipnet:142.0.180.0/22, country:US]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[tundraware.com:+,email-od.com:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCVD_COUNT_THREE(0.00)[4]; DWL_DNSWL_NONE(0.00)[email-od.com:dkim] X-Rspamd-Queue-Id: 4PDZYr2ph9z3y0V X-Spamd-Bar: --- X-ThisMailContainsUnwantedMimeParts: N > On Sat, Feb 11, 2023, 15:59 Per olof Ljungmark > wrote: > > Hi all, > > A little help on the way, I need to find and remove the double quote (") > character from all files in a directory structure containing hundreds of > thousands of files. > > I am sure plenty of you have done this before... I've gotten as far as > > find . -type f -name '*"*' -exec rename 's|"|in|g' {} \; > find: rename: No such file or directory > > The find part works but not renaming so I'm missing something there. > Some years ago I set about to write the mother of all renaming utilities exactly because I didn't want to have to go through endless contortions of sed, gerp, awk, ag, and so forth to do simple renaming tasks like yours. The result is 'tren' which does what you want rather trivially: find ./ -name '*"*' -exec tren -r'"'=X {} \; tren can do way more than this (and probably has plenty of undiscovered edge cases and/or bugs), but I use it regularly and it has vastly simplified my renaming tasks. Code and extensive docs here: https://gitbucket.tundraware.com/tundra/tren HTH...