Date: Mon, 18 Sep 2017 13:10:54 +0930 From: Shane Ambler <FreeBSD@ShaneWare.Biz> To: Polytropon <freebsd@edvax.de>, mfv@bway.net Cc: freebsd-questions@freebsd.org Subject: Re: case command Message-ID: <9b5867e7-4b41-5a7e-fb79-316ccb474e7b@ShaneWare.Biz> In-Reply-To: <20170917223211.bd017503.freebsd@edvax.de> References: <59BE89E1.3050209@gmail.com> <20170917193722.7d2ecbe3.freebsd@edvax.de> <20170917160758.18b6000e@gecko4> <20170917223211.bd017503.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <freebsd@edvax.de> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9b5867e7-4b41-5a7e-fb79-316ccb474e7b>