<?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 Shell script question using sed or awk in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973935#M102071</link>
    <description>How do i convert individual characters to upper case and also remove redundant characters at the same time. My data is the following&lt;BR /&gt;&lt;BR /&gt;john.doe&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How do i convert it to:&lt;BR /&gt;&lt;BR /&gt;John Doe</description>
    <pubDate>Mon, 17 Apr 2006 08:24:05 GMT</pubDate>
    <dc:creator>Unix or Linux?</dc:creator>
    <dc:date>2006-04-17T08:24:05Z</dc:date>
    <item>
      <title>Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973935#M102071</link>
      <description>How do i convert individual characters to upper case and also remove redundant characters at the same time. My data is the following&lt;BR /&gt;&lt;BR /&gt;john.doe&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How do i convert it to:&lt;BR /&gt;&lt;BR /&gt;John Doe</description>
      <pubDate>Mon, 17 Apr 2006 08:24:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973935#M102071</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-17T08:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973936#M102072</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt; echo john.doe |tr [:lower:] [:upper:] |tr . " "&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Apr 2006 08:35:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973936#M102072</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-04-17T08:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973937#M102073</link>
      <description>I think that will convert everything to upper case whereas I need specific characters converted. I need the first character and the character after the full stop.</description>
      <pubDate>Mon, 17 Apr 2006 08:43:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973937#M102073</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-17T08:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973938#M102074</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# echo "john doe"|perl -ne '@a=split;foreach (@a) {push @b,ucfirst};print "@b\n"'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Apr 2006 08:59:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973938#M102074</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-17T08:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973939#M102075</link>
      <description>Great thank you, it worked. Is there any way that this can be done with awk or sed?</description>
      <pubDate>Mon, 17 Apr 2006 09:05:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973939#M102075</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-17T09:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973940#M102076</link>
      <description>Try with this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/awk -f&lt;BR /&gt;# convert upper case letters to lower case&lt;BR /&gt;BEGIN {&lt;BR /&gt;    SEPARATOR_CHAR=".";&lt;BR /&gt;    LC="abcdefghijklmnopqrstuvwxyz";&lt;BR /&gt;    UC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;    out="";&lt;BR /&gt;    separator=0;&lt;BR /&gt;# look at each character&lt;BR /&gt;    for(i=1;i&amp;lt;=length($0);i++) {&lt;BR /&gt;        # get the character to be checked&lt;BR /&gt;        char=substr($0,i,1);&lt;BR /&gt;        j=index(LC,char);&lt;BR /&gt;        # is it the first letter?&lt;BR /&gt;            if (( i == 1 ) || ( separator == 1 )) {&lt;BR /&gt;        #       print (char);&lt;BR /&gt;                out = out substr(UC,j,1);&lt;BR /&gt;                separator = 0;&lt;BR /&gt;            }&lt;BR /&gt;            else if (char == SEPARATOR_CHAR ) {&lt;BR /&gt;                char=" ";&lt;BR /&gt;                out = out char&lt;BR /&gt;                separator=1&lt;BR /&gt;            } else {&lt;BR /&gt;                out = out char;&lt;BR /&gt;            }&lt;BR /&gt;&lt;BR /&gt;    }&lt;BR /&gt;    printf("%s\n", out);&lt;BR /&gt;}</description>
      <pubDate>Mon, 17 Apr 2006 09:11:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973940#M102076</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-04-17T09:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973941#M102077</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;With 'awk' the problem becomes more tedious since you would have to isolate the first character of each "word" (say with 'substr'); convert it to uppercase with 'toupper'; and then convert the remaining characters of that word to lowercase with 'tolower'.  Perl offers far, far many more features than does 'awk'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 17 Apr 2006 09:16:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973941#M102077</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-17T09:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973942#M102078</link>
      <description>ok but the problem is I dont understand the statement&lt;BR /&gt;&lt;BR /&gt;echo "john doe"|perl -ne '@a=split;foreach (@a) {push @b,ucfirst};print "@b\n"'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Could you give an explanation of the statement.&lt;BR /&gt;Thank you</description>
      <pubDate>Mon, 17 Apr 2006 09:22:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973942#M102078</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-17T09:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973943#M102079</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;# echo "john doe"|perl -ne '@a=split;foreach (@a) {push @b,ucfirst};print "@b\n"'&lt;BR /&gt;&lt;BR /&gt;The perl switch '-n' says create a read loop.  For every line read, split on whitespace (blanks, or tabs) the line's elements into a list called "a".  Now, walk each element of list "a", and uppercase the first character of each element.  As you do this, "push" (store) the result into a new list called "b".  When every element in a line has been handled, print the modified line.&lt;BR /&gt;&lt;BR /&gt;You could use this with a file, like:&lt;BR /&gt;&lt;BR /&gt;# perl -ne '@a=split;foreach (@a) {push @b,ucfirst};print "@b\n"' yourfile&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 17 Apr 2006 09:42:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973943#M102079</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-17T09:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973944#M102080</link>
      <description>Great but it doesnt seem to append to a file. All the other statments do append to a file. My code is as follows:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; testFile&lt;BR /&gt;printf "\n" &amp;gt;&amp;gt; testFile&lt;BR /&gt;echo "john.doe"|perl -ne '@a=split;foreach (@a) {push @b,ucfirst};print "@b\n\n"' &amp;gt;&amp;gt; testFile&lt;BR /&gt;ps -U john.doe &amp;gt;&amp;gt; testFile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Its only the echo line that is not appending to testFile. Any ideas why?&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Apr 2006 09:56:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973944#M102080</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-17T09:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973945#M102081</link>
      <description>Ignore last message, I spelled the filename incorrectly :(</description>
      <pubDate>Mon, 17 Apr 2006 10:11:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973945#M102081</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-17T10:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973946#M102082</link>
      <description>Answer found. Thank you.</description>
      <pubDate>Mon, 17 Apr 2006 10:11:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973946#M102082</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-17T10:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973947#M102083</link>
      <description>Your example seems ok. I ran it and testFile has the results expected...&lt;BR /&gt; &lt;BR /&gt;The first line-&lt;BR /&gt; &lt;BR /&gt;&amp;gt;testFile&lt;BR /&gt; &lt;BR /&gt;Which redirects all standard output for all commands that follow to testFile can be dangerous if you try to run additional commands (like cat testFile), without redirecting standard output back to your tty.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 17 Apr 2006 10:13:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973947#M102083</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2006-04-17T10:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script question using sed or awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973948#M102084</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;While my original solution met your requirements, there is a better approach.&lt;BR /&gt;&lt;BR /&gt;If you want to preserve whitespace (i.e keep multiple, embedded spaces and tab characters), you can use:&lt;BR /&gt;&lt;BR /&gt;# perl -ple 's,(\w+),\u\L$1,g'&lt;BR /&gt;&lt;BR /&gt;If you want to eliminate redundanat, embedded whitespace, use:&lt;BR /&gt;&lt;BR /&gt;# perl -ple 's,(\w+),\u\L$1,g;s,\s+, ,g'&lt;BR /&gt;&lt;BR /&gt;As before, the first character of each "word" will be uppercased and the trailing characters lowercased.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 17 Apr 2006 13:34:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-question-using-sed-or-awk/m-p/4973948#M102084</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-17T13:34:36Z</dc:date>
    </item>
  </channel>
</rss>

