From owner-freebsd-questions@freebsd.org Mon Sep 18 03:46:08 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64DA8E1B88C for ; Mon, 18 Sep 2017 03:46:08 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: from ipmail06.adl6.internode.on.net (ipmail06.adl6.internode.on.net [150.101.137.145]) by mx1.freebsd.org (Postfix) with ESMTP id 01B4B7D53B for ; Mon, 18 Sep 2017 03:46:07 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: from ppp118-210-151-17.bras1.adl6.internode.on.net (HELO leader.local) ([118.210.151.17]) by ipmail06.adl6.internode.on.net with ESMTP; 18 Sep 2017 13:10:56 +0930 Subject: Re: case command To: Polytropon , mfv@bway.net Cc: freebsd-questions@freebsd.org References: <59BE89E1.3050209@gmail.com> <20170917193722.7d2ecbe3.freebsd@edvax.de> <20170917160758.18b6000e@gecko4> <20170917223211.bd017503.freebsd@edvax.de> From: Shane Ambler Message-ID: <9b5867e7-4b41-5a7e-fb79-316ccb474e7b@ShaneWare.Biz> Date: Mon, 18 Sep 2017 13:10:54 +0930 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170917223211.bd017503.freebsd@edvax.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Sep 2017 03:46:08 -0000 On 18/09/2017 06:02, Polytropon wrote: > On Sun, 17 Sep 2017 16:07:58 -0400, mfv wrote: >>> On Sun, 2017-09-17 at 19:37 Polytropon wrote: >>> >>> On Sun, 17 Sep 2017 10:42:41 -0400, Ernie Luzar wrote: >>>> Looking for a system command that a I can pip a file through to >>>> change all uppercase content to lower case. >>>> >>>> Is there such a command line command? >>> >>> Several ones. One is to use tr: >>> >>> ... | tr '[A-Z]' '[a-z]' | ... >>> >>> Or with character classes: >>> >>> ... | tr '[:upper:]' '[:lower:] | ... >>> >>> You can also use awk for this task: >>> >>> ... | awk '{ print tolower($0) }' | ... >>> >>> You can use this within the awk portion of your script, too. >>> >>> Or shortened: >>> >>> ... | awk '{ print tolower }' | ... >>> >>> But keep in mind: Things like german Umlauts usually won't >>> be processed correctly. >>> >>> Those are a few possible solutions. There are more. ;-) >>> >> Hello, >> >> Yes, Indeed. Here is an alternative using gsed: >> >> gsed -e 's/(.*)/\L\1/' < input | ... >> >> To convert from lower case to upper case, change '\L' to '\U'. > > This only works with GNU sed (gsed), to be installed from ports. > FreeBSD's native sed implementation does not support \L and \U, > so you'd have to install GNU sed additionally. Well as we're listing alternate ways - cat upper.txt | perl -ne 'print lc' and to reverse it - perl -ne 'print uc' lower.txt ;) -- FreeBSD - the place to B...Seding Data Shane Ambler