From owner-freebsd-questions@FreeBSD.ORG Tue Dec 16 18:35:15 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34290CEE for ; Tue, 16 Dec 2014 18:35:15 +0000 (UTC) Received: from mail-pd0-x235.google.com (mail-pd0-x235.google.com [IPv6:2607:f8b0:400e:c02::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 020E59BA for ; Tue, 16 Dec 2014 18:35:15 +0000 (UTC) Received: by mail-pd0-f181.google.com with SMTP id v10so14445321pde.40 for ; Tue, 16 Dec 2014 10:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=LAb/AV8DrwWIpOkwLE3As0mnD7MmtAgkKznw4s/5I/0=; b=bXQND5LSNM9Dk8vBIFhmmTSOCi4O1U5SSiBKBWoXi3/uWSMnARxw+E0QYqbLHT2twx RMjNjwvkVMHGA3f5x5Y9VEtG1lPaQIuBXzOeU9zpc4Fb39Cftzi6HhKg8xPJi5bl1brQ x/fz2BB2yV9ZOO8an3eA9S03rxwjTcaJ1yns9CwtCvOCSEgojwhX2iqFm82eAn+16xLs VO73KY+CEUvEnVEetCS4YbU9UMaQNk6Rhxa21pqU+9sS+XRGnZaU2EPxPJpskEPANHEW j3oUCzCoYS0snjH80sN+Qcc6/ayR7cvlzPPLYjlEG8Fm/ULbBASSX0h6a84S5OrNRnJ9 4wdw== X-Received: by 10.66.157.101 with SMTP id wl5mr62204822pab.37.1418754914536; Tue, 16 Dec 2014 10:35:14 -0800 (PST) Received: from [192.168.1.34] ([209.12.167.61]) by mx.google.com with ESMTPSA id t9sm1587086pbs.75.2014.12.16.10.35.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Dec 2014 10:35:14 -0800 (PST) Message-ID: <54907B51.1060807@gmail.com> Date: Tue, 16 Dec 2014 10:34:57 -0800 From: Jungle Boogie User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: "freebsd-questions@freebsd.org" Subject: Perl rename utility assistance Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2014 18:35:15 -0000 Hello All, I figure I would try my luck here with this question. Usually I go to stackoverflow for these things so pardon the noise if you're not accustom to seeing letters like this. Objective: remove an underscore from a filename using rename[0]. Example: 8213_freebsd_is_cool_Nov_2014.pdf I only want to remove the underscore (_) between the 3 and f to make it: 8213 freebsd_is_cool_Nov_2014.pdf or 8213 _freebsd_is_cool_Nov_2014.pdf rename '-sr/^([:digit:]_) /^[:digit:] /g' * rename '-s/^[:digit:]_/^[:digit:] /g' * rename '-sr/^[:digit:]_/^[:digit:] /g' * Doesn't return any errors but the files don't get updated either. man page: rename -s/^[A-Z].*file/nofile/r * The target substring starts with a capital letter, and ends with string 'file'. There are 0 or any numbers of characters between the capital letter and 'file'. The substring, if encountered in filenames, will be replaced with 'nofile'. How is this supposed to actually work? [0] https://www.freshports.org/sysutils/rename/ -- inum: 883510009027723 sip: jungleboogie@sip2sip.info xmpp: jungle-boogie@jit.si