From nobody Sun Dec 08 05:49:53 2024 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 4Y5Yx41XFlz5g7m3 for ; Sun, 08 Dec 2024 05:50:00 +0000 (UTC) (envelope-from grahamperrin@gmail.com) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y5Yx23ggDz4540 for ; Sun, 8 Dec 2024 05:49:58 +0000 (UTC) (envelope-from grahamperrin@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=gwswyamx; spf=pass (mx1.freebsd.org: domain of grahamperrin@gmail.com designates 2a00:1450:4864:20::32d as permitted sender) smtp.mailfrom=grahamperrin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-434e3953b65so7733655e9.1 for ; Sat, 07 Dec 2024 21:49:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733636995; x=1734241795; darn=freebsd.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+HE92BCL8W+adwpFYt1UlJhl1KtZu0IR6s7eGXnzalM=; b=gwswyamxV7yKp0t4zyFPd3NtSJqkge5ZB2S//1jNgoYAPE80zEeB3etnYWeWUW0sD+ GcJImAuRbW0yWMR8dErpIc2x1eEJ7+hgWpzMER91sUMd9XqbOMIDrXkUbvdKYLThkW5m gufxmfOVx/yxnXzaWJ+FEO+rZPIxUqYACRLxyxZolkMioYk9DIABGYhF/dNtAX75slGf gwvIZ1urOgn1Cw5dHFVNG5/0hVW/iWwiIO0fgVWOp/YAJw8PXJ6mErlv7oGRA6m847SH RDwOm+WFkrgbbnRRcKvfKnAPDqik3zGa4XFochx9EOkBa5bXIOAlu/o3GL1Vt2Kfs1Wn q/rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733636995; x=1734241795; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+HE92BCL8W+adwpFYt1UlJhl1KtZu0IR6s7eGXnzalM=; b=VJ6OoNrFcTuHtqzhYSmxrOIk6v5KalvAXPPeF5JvN4Dvh+bFLGNvem12utM7UGy6Fo 34U2KvaX4pwZ8C2Lyg8d+376kHmNjXsvoC02yQBOHs8jI+2ICE0m1v0+PYhxPmEz3+M8 g/JpgIeXHKl3YYEYd0ImkllDWK5IxA+agPhYSLVs9JwSACTEmvVICHnpE0YIABswZK5Y AeVz3SKc8MUAJ7LcUG0IrJp/qgavxLAQmNr7kzBuJVHbeZaVC+ojOc+CyRioWeYsw2DB K+Cy6x8uoNw01fCRsgV/inHTI6W3HnzwTQKZ+ppiKF+LbPdcS8G0878PoocGRhtnuuOe f3uA== X-Gm-Message-State: AOJu0Yzbhf8b5Yz53NoKsMXr2B9/aYsY3BWqmDOT+pBDordp/T3G28Jc qq/cZ1cmE9nec0Evjt8z8W0OMfAvpn6JIFB4n3zEQhoqWUUnhaegzcZDiDlN X-Gm-Gg: ASbGncsXDkRMFDOchmv0847RsIBeuVNAy0MCvO8J/Vmv36WpV1LRF2WFy3dNdh37qFh 2et1nM3yO/OvGCbTipkg0YkaovbmGYICP+Ag27UMTTnbxKGDNOvynVNpNAJo5QOfWfVq9cWqAYI y61js0E9Fqzfmz3zvuFT55VKOKrkLsvpY/9x+Z2sJQBdRQ4Uclj8BUavumive1cC5YIsn0hJEr7 aKZi2w9bW1tsMNJGaBRIG219l9271uRrqbZ7hTjV9pwGJMTHoCXOwgKdYWIs5YZ52NC7Y3rrL5M DeSUrXo= X-Google-Smtp-Source: AGHT+IElYTGznXU/WE2/yCU22NOAfZ2Wa1IE4kr9v5wZ4kpfhtCiLwDeQLCOGO6zHm3GI3BmYitXew== X-Received: by 2002:a7b:c00c:0:b0:434:e2ea:fc94 with SMTP id 5b1f17b1804b1-434e2eafcaemr43686305e9.11.1733636995205; Sat, 07 Dec 2024 21:49:55 -0800 (PST) Received: from [192.168.1.10] (host-78-147-83-34.as13285.net. [78.147.83.34]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434d5273440sm147661355e9.18.2024.12.07.21.49.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Dec 2024 21:49:54 -0800 (PST) Message-ID: Date: Sun, 8 Dec 2024 05:49:53 +0000 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: shell script for removing unprintable characters in file names To: questions@freebsd.org References: <95966dac-9d93-401f-9948-5fcb224a1e1f@nethead.se> From: Graham Perrin Content-Language: en-GB Autocrypt: addr=grahamperrin@gmail.com; keydata= xsFNBGKYt7ABEAClu83dJ3ZKfVgPOk9YKRv0Z+dl2b88+k9R4vwAmElgguYdKE7yhnQNhhWM v9vi6AFrBMc2oJdVHJ2OrXfwpELBFIgiSMEWNsC4e+Z3HtSajcl+pFZsP7ciiSoycj/w3wIV kAZoVGbhyIbNG7fbCEJ8q81TbfsGypV3bRmbZVvGNecBguYiooBtz2Qht1p3itXMkIA6P9pS YDl+6QddZLyUUAjAnFv2QDoYSHLnaD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0HVMugQj0Om+iNPsEEOGHkm6tyhHMzlKGpAc/l0iAM+8twIyg44Yo5+DcfFXr OMTbTw9T9jDsWOkOBksxy29iYhgpqpWdDBnhXvrJp/FNAiX8CfzrIOZeFPydDoEiKBEXAxfe a9o5J/JeVnZiUeoiFe7i68nZGsb4JxhPczNfqW12t0Ll5/ibjszg5BgjXiLao0KqbWNh4bS5 CVwH90Or+5qqWgzWPeBiuz+rN2QXE/V/fL44GEj1YKASCqmaiYRgjoRFubz1aq1wCXMXY3Iq d4525rscUgS7HBxbblnyTodUPaamN/2nSzcmE/Pkx8MApDSgZCIhs0RTAg+/AoX4HULV1rSE TQwMrBEQt84Tw5W5rHsvXKr4ZEsJUpbPLWYTISsp23nHR+vZtL/Ug+OWCmHC7X7D21xk/xVJ 4sA1RLJBKdCHtnyA4Unv/kNS1KVGxHnITVyw1a71QJADu4qsdtM5u6CyYUhqhM1oseWtV6j+ Qi8KC/G4C3AgZf06fe2fVl42z2grTabL4bC6FQXMwTX2dsm5NakWjUCmUL8uwsQE7ZA4zKxo EYI1YV9q1birpzncYRupr1qnMoggMUHWq0IBYshFQrEO8PeVUZBw7/GfAeh3argdw2Qu748T Cyw= In-Reply-To: <95966dac-9d93-401f-9948-5fcb224a1e1f@nethead.se> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-3.99 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; NEURAL_HAM_SHORT(-1.00)[-0.998]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_ONE(0.00)[1]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; FREEMAIL_FROM(0.00)[gmail.com]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[grahamperrin]; FREEMAIL_ENVFROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[questions@freebsd.org]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::32d:from] X-Rspamd-Queue-Id: 4Y5Yx23ggDz4540 X-Spamd-Bar: --- On 30/11/2024 15:33, Per olof Ljungmark wrote: > Hi, > > I am tasked with recovering hundreds or more files created with > unknown OSs and have unknown characters in the name, replaced with a '?'. > > Like file?nam?.??? > > Please, if you have such a script can you post or email it? Replacing > the unknown character with anything, like '-' or '_' using whatever > shell, sh, bash or csh. > > Thanks a lot! This is off-topic, but it appeared (probably as a fortune/tip) on the same day as me reading your email, so I'll throw it into the mix: Want to strip UTF-8 BOM(Byte Order Mark) from given files?         sed -e '1s/^\xef\xbb\xbf//' < bomfile > newfile