<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: sed and tr in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806197#M83096</link>
    <description>tr is geared to do character by character translations. When you use [:upper:] or [:lower:] in sed, that is used in a regular expression only for searching.&lt;BR /&gt;&lt;BR /&gt;If I did &lt;BR /&gt;  sed -e 's/[123]/a/g'&lt;BR /&gt;&lt;BR /&gt;Then that would replace either 1, 2, or 3 with "a".&lt;BR /&gt;&lt;BR /&gt;Instead of 123 I use character class [:upper:]&lt;BR /&gt;  sed -e 's/[[:upper:]]/a/g'&lt;BR /&gt;&lt;BR /&gt;that would be the same as-&lt;BR /&gt;  sed -e 's/[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/a/g'&lt;BR /&gt;&lt;BR /&gt;Which would replace all uppercase characters with "a". So using [[:lower:]] doesn't translate to the equivalent lower case character.&lt;BR /&gt;&lt;BR /&gt;I hope that clarifies your question...&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
    <pubDate>Fri, 13 Sep 2002 19:13:35 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2002-09-13T19:13:35Z</dc:date>
    <item>
      <title>sed and tr</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806194#M83093</link>
      <description>Hi friends,&lt;BR /&gt;&lt;BR /&gt;a quick question, I'm using "tr" to change all capital letters in a file to small letters &lt;BR /&gt;&lt;BR /&gt;cat textfile|tr [:upper:] [:lower:]&lt;BR /&gt;&lt;BR /&gt;but when I try to do the same with "sed"&lt;BR /&gt;cat textfile|sed 's/[[:upper:]]/[[:lower:]]/'&lt;BR /&gt;&lt;BR /&gt;it change all capital letters to string "[[:lower:]]", so how can we use sed for that.&lt;BR /&gt; &lt;BR /&gt;PS. why [[:upper:]] in sed instead of [:upper:]&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;Gary</description>
      <pubDate>Fri, 13 Sep 2002 18:50:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806194#M83093</guid>
      <dc:creator>Gary Yu</dc:creator>
      <dc:date>2002-09-13T18:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: sed and tr</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806195#M83094</link>
      <description>not very pretty, but straight out of the sed and awk book...&lt;BR /&gt;&lt;BR /&gt;sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'&lt;BR /&gt;&lt;BR /&gt;that should change any caps to its corresponding lowercase...</description>
      <pubDate>Fri, 13 Sep 2002 19:10:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806195#M83094</guid>
      <dc:creator>Ted Ellis_2</dc:creator>
      <dc:date>2002-09-13T19:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: sed and tr</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806196#M83095</link>
      <description>the y is the sed transform command... so use this instead of s</description>
      <pubDate>Fri, 13 Sep 2002 19:11:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806196#M83095</guid>
      <dc:creator>Ted Ellis_2</dc:creator>
      <dc:date>2002-09-13T19:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: sed and tr</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806197#M83096</link>
      <description>tr is geared to do character by character translations. When you use [:upper:] or [:lower:] in sed, that is used in a regular expression only for searching.&lt;BR /&gt;&lt;BR /&gt;If I did &lt;BR /&gt;  sed -e 's/[123]/a/g'&lt;BR /&gt;&lt;BR /&gt;Then that would replace either 1, 2, or 3 with "a".&lt;BR /&gt;&lt;BR /&gt;Instead of 123 I use character class [:upper:]&lt;BR /&gt;  sed -e 's/[[:upper:]]/a/g'&lt;BR /&gt;&lt;BR /&gt;that would be the same as-&lt;BR /&gt;  sed -e 's/[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/a/g'&lt;BR /&gt;&lt;BR /&gt;Which would replace all uppercase characters with "a". So using [[:lower:]] doesn't translate to the equivalent lower case character.&lt;BR /&gt;&lt;BR /&gt;I hope that clarifies your question...&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Fri, 13 Sep 2002 19:13:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806197#M83096</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-09-13T19:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: sed and tr</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806198#M83097</link>
      <description>Gary,&lt;BR /&gt;&lt;BR /&gt;Yet another reason why Larry Wall wrote Perl:&lt;BR /&gt;&lt;BR /&gt;perl -ne 'print lc()' textfile&lt;BR /&gt;&lt;BR /&gt;Will print your file in all lower case.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Sep 2002 19:15:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806198#M83097</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2002-09-13T19:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: sed and tr</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806199#M83098</link>
      <description>thanks guys,&lt;BR /&gt;&lt;BR /&gt;Ted's way works(never used 'y' function before).&lt;BR /&gt;&lt;BR /&gt;thanks Rodney for the clarification. BTW, the example sed -e 's/[123]/a/g' , shouldn't it be [1|2|3]&lt;BR /&gt;&lt;BR /&gt;Gary</description>
      <pubDate>Fri, 13 Sep 2002 19:21:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806199#M83098</guid>
      <dc:creator>Gary Yu</dc:creator>
      <dc:date>2002-09-13T19:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: sed and tr</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806200#M83099</link>
      <description>No- I think you are thinking of (1|2|3) which is different. [123] is an implied or for all characters in the list. ^ does a logical not, so [^123] would match everything except 1, 2, or 3.&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Fri, 13 Sep 2002 19:24:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806200#M83099</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-09-13T19:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: sed and tr</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806201#M83100</link>
      <description>A side note 1&lt;BR /&gt;&lt;BR /&gt;[:lower:] and friends and perl's uc () and lc () functions also take LOCALE settings into consideration, and are portable to EBCDIC character sets where [a-z] and [A-Z] will fail&lt;BR /&gt;&lt;BR /&gt;As side note 2&lt;BR /&gt;&lt;BR /&gt;probably becoming a peeve pet, but why the h**l do all those examples include the cat command? Is it a hobby to fill the system's process space, or are people still not told enough that unix is based on pipes and redirects are the way to go?&lt;BR /&gt;&lt;BR /&gt;# perl -pe'$_=lc' textfile&lt;BR /&gt;&lt;BR /&gt;will do what you want fast and reliable&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Sep 2002 13:37:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-and-tr/m-p/2806201#M83100</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-09-16T13:37:14Z</dc:date>
    </item>
  </channel>
</rss>

