From nobody Sat Feb 11 18:40:27 2023 X-Original-To: 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 4PDfYg3mxDz3pr1h for ; Sat, 11 Feb 2023 18:40:39 +0000 (UTC) (envelope-from pprocacci@gmail.com) Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PDfYg3Lg1z4bL0 for ; Sat, 11 Feb 2023 18:40:39 +0000 (UTC) (envelope-from pprocacci@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-oi1-x233.google.com with SMTP id bd6so7151762oib.6 for ; Sat, 11 Feb 2023 10:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gxAOImM00+AH5LBAvvOliOEvX38wCY2nFbBOe2aFJ5w=; b=DwygoiRJdWrphvpnTNk8jPsfXHBw1q/hA0PqgCkBKZm5WQbMMtd4rMMAw+len1zjXl Ra5yB19EVnwcHarUHk89vIrlHVks0pTT5zekGPWILQYEwU0jsGRt/MBnXNyXNeKSoRl9 MuMMLOURKae9PfPGErcneywrGvqjjZYqF+wr/jqdWPKZmjb4hI2j6kq4iSKNysaYhD9d rEyQztNL4ydh5cPIEt6i0V5HcsYzhoEQtu9NqqxcxuQGOaiUUcp1ftLzPQcUWYF1Snjs RdYxzYNQFw7w8e5vq3I0FOpC4OCloT93QaIQYyaYZRY2cozi512NPAzNV7QqvKBQ8LqY f4UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gxAOImM00+AH5LBAvvOliOEvX38wCY2nFbBOe2aFJ5w=; b=kobJF5UpUbot4nIaURdAVdgIdq2WDc5VhIipImEyg6g/0wobZMEBEi+GQvzPlDUywE hfhLkB0KoCs80oUtLF+KA3a6629acG1DqtuWWXaNcp0m7CR8NB6XcRzkzub4jXgfqhPs RVu8OBx0v0XKHSRAgVcKBDhlS8m42nIoEeic1VvK53+0wO3xGXiauWhDjwLJZ0QjcWkZ wd4gR/VvzAgth60TdAM6+DUOxaTX8WSnhHHLTwI+gHxVoQt/xN8U2FHwL5gnY8DNVsOt 9jE9uR3zN/9nvwo4MerEd9Q/CCU7UWHtPLJWpjz+wY1ewvbp276jUdg2XIj/VfCj/Mcu pHNg== X-Gm-Message-State: AO0yUKUdGszJASsvDPyL/ORug6IAQpKqdUG2bCq+R/vdW1NdbwTHlbKH PAhC7j22OyMLHg63bzmf5luNYrdWGqLeApLqMTVZjFR48tno X-Google-Smtp-Source: AK7set8o9Glz0GZz2ghQ4gGoNu95FPMcTCWEhp72ZLPNil5EyjmXO7fJlQzHUSQ1Zbet0ZTUYgoVfXScF0PgUc6V3/k= X-Received: by 2002:aca:acd5:0:b0:368:356e:8509 with SMTP id v204-20020acaacd5000000b00368356e8509mr914265oie.225.1676140838534; Sat, 11 Feb 2023 10:40:38 -0800 (PST) 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 References: In-Reply-To: From: Paul Procacci Date: Sat, 11 Feb 2023 13:40:27 -0500 Message-ID: Subject: Re: remove double quote character from file names To: Kurt Hackenberg Cc: questions@freebsd.org Content-Type: multipart/alternative; boundary="0000000000004642f905f470f34e" X-Rspamd-Queue-Id: 4PDfYg3Lg1z4bL0 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --0000000000004642f905f470f34e Content-Type: text/plain; charset="UTF-8" On Sat, Feb 11, 2023 at 1:32 PM Kurt Hackenberg wrote: > On Sat, Feb 11, 2023 at 03:58:50PM +0100, Per olof Ljungmark wrote: > > >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. > > That's nasty. Be careful, keep backups. > > I might use a full-on programming language -- maybe Python or Ruby -- > to avoid the difficulties of shell parsing and quoting. However, if you > want to do it through a shell, this might be helpful: > > > > My way. Doesn't account for spaces in filenames, but that's easily added with -print0 flags to find and -0 flags to xargs: ls *\"* | perl -lne '$n=$_;$n=~tr/"//d;rename($_,$n);' ~Paul -- __________________ :(){ :|:& };: --0000000000004642f905f470f34e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sat, Feb 11, 2023 at 1:32 PM = Kurt Hackenberg <kh@panix.com> wr= ote:
On Sat, Feb= 11, 2023 at 03:58:50PM +0100, Per olof Ljungmark wrote:

>A little help on the way, I need to find and remove the double quote (&= quot;)
>character from all files in a directory structure containing hundreds o= f
>thousands of files.

That's nasty. Be careful, keep backups.

I might use a full-on programming language -- maybe Python or Ruby --
to avoid the difficulties of shell parsing and quoting. However, if you want to do it through a shell, this might be helpful:

<https://dwheeler.com/essays/filenames-in-shel= l.html>


My way.=C2=A0 Doesn't account for spaces in file= names, but that's easily added with -print0 flags to find and -0 flags = to xargs:

ls *\"* | perl -lne '$n=3D$_;$n=3D~tr/"//d;rename($_,$n);'= ;

~Paul

--
__________________

:(){ :|:& };:
<= /div>
--0000000000004642f905f470f34e--