<?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: Challenging script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002260#M98672</link>
    <description>Actually using:&lt;BR /&gt;&lt;BR /&gt;uname -sr &lt;BR /&gt;&lt;BR /&gt;SunOS 5.8</description>
    <pubDate>Tue, 26 Sep 2006 11:50:07 GMT</pubDate>
    <dc:creator>Unix or Linux?</dc:creator>
    <dc:date>2006-09-26T11:50:07Z</dc:date>
    <item>
      <title>Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002246#M98658</link>
      <description>I need to append some lines to the end of the of a file. The file consists of blocks of lines that correspond to a particular user E.g. BOB . I need a script that will copy this block of lines (currently nine lines), change the name of the user to the name supplied as a parameter to the script and append it to the end of the file before the line that states:&lt;BR /&gt;&lt;BR /&gt;ErrorLog logs/error_log&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I should also point out that on each line, the user name is upper case for the first instance then lower case for the second. Find an example below.&lt;BR /&gt;&lt;BR /&gt;Alias /BOB/block/ "/space/home/dir1/dir2/dir3/block/bob/block/"&lt;BR /&gt;Alias /BOB/doc/ "/space/home/dir1/dir2/dir3/block/bob/doc/"&lt;BR /&gt;Alias /BOB/out1/ "/space/home/dir1/dir2/dir3/block/bob/out1/"&lt;BR /&gt;Alias /BOB/out2/ "/space/home/dir1/dir2/dir3/block/bob/out2/"&lt;BR /&gt;Alias /BOB/out3/ "/space/home/dir1/dir2/dir3/block/bob/out2/out3/"&lt;BR /&gt;Alias /BOB/out4/ "/space/home/dir1/dir2/dir3/block/bob/out2/out4/"&lt;BR /&gt;Alias /BOB/test/out3/ "/space/home/dir1/dir2/dir3/block/bob/test/out3/"&lt;BR /&gt;Alias /BOB/test/out4/ "/space/home/dir1/dir2/dir3/block/bob/test/out4/"&lt;BR /&gt;Alias /BOB/out5/ "/space/home/dir1/dir2/dir3/block/bob/out5/"&lt;BR /&gt;ErrorLog logs/error_log</description>
      <pubDate>Sat, 09 Sep 2006 09:34:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002246#M98658</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-09T09:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002247#M98659</link>
      <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;This seems to be according to your specifications.&lt;BR /&gt;&lt;BR /&gt;Create a "template" file and name anything you want.  I'll call it '/tmp/template'.  It should look like:&lt;BR /&gt;&lt;BR /&gt;Alias /UUUUUU/block/ "/space/home/dir1/dir2/dir3/block/uuuuuu/block/"&lt;BR /&gt;Alias /UUUUUU/doc/ "/space/home/dir1/dir2/dir3/block/uuuuuu/doc/"&lt;BR /&gt;Alias /UUUUUU/out1/ "/space/home/dir1/dir2/dir3/block/uuuuuu/out1/"&lt;BR /&gt;Alias /UUUUUU/out2/ "/space/home/dir1/dir2/dir3/block/uuuuuu/out2/"&lt;BR /&gt;Alias /UUUUUU/out3/ "/space/home/dir1/dir2/dir3/block/uuuuuu/out2/out3/"&lt;BR /&gt;Alias /UUUUUU/out4/ "/space/home/dir1/dir2/dir3/block/uuuuuu/out2/out4/"&lt;BR /&gt;Alias /UUUUUU/test/out3/ "/space/home/dir1/dir2/dir3/block/uuuuuu/test/out3/"&lt;BR /&gt;Alias /UUUUUU/test/out4/ "/space/home/dir1/dir2/dir3/block/uuuuuu/test/out4/"&lt;BR /&gt;Alias /UUUUUU/out5/ "/space/home/dir1/dir2/dir3/block/uuuuuu/out5/"&lt;BR /&gt;&lt;BR /&gt;Now, use the following Perl script:&lt;BR /&gt;&lt;BR /&gt;# cat ./insert&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;die "Usage: $0 name template file\n" unless $#ARGV == 2;&lt;BR /&gt;my $name  = shift;&lt;BR /&gt;my $tempf = shift;&lt;BR /&gt;my $template;&lt;BR /&gt;{&lt;BR /&gt;    local $/ = undef;&lt;BR /&gt;    open( FH, "&amp;lt;", "$tempf" ) or die "Can't open '$tempf': $!\n";&lt;BR /&gt;    $template = &lt;FH&gt;;&lt;BR /&gt;    close FH;&lt;BR /&gt;}&lt;BR /&gt;$template =~ s/UUUUUU/\U$name/g;&lt;BR /&gt;$template =~ s/uuuuuu/\L$name/g;&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;    if (m/^ErrorLog/) {&lt;BR /&gt;        print $template, $_;&lt;BR /&gt;    }&lt;BR /&gt;    else {&lt;BR /&gt;        print $_;&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;...Run your script thusly:&lt;BR /&gt;&lt;BR /&gt;# ./insert jRf /tmp/template /tmp/errorlog &amp;gt; /tmp/errorlog.new&lt;BR /&gt;&lt;BR /&gt;...where the first argument is the user name you want replaced, the second argument is the template file name and the third argument is the name of the file into which you want the modified template inserted.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/FH&gt;</description>
      <pubDate>Sat, 09 Sep 2006 11:20:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002247#M98659</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-09T11:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002248#M98660</link>
      <description>My Perl skills are not too good! Is there any way to do this using SED or AWK ?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 09 Sep 2006 11:25:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002248#M98660</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-09T11:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002249#M98661</link>
      <description>&lt;!--!*#--&gt;Based on your post I'm assuming that the lines containing "BOB and bob" are to be replaced by the shell script parameter and after substitution you want those lines copied (within the same file) right before the line that begins with "ErrorLog logs/error_log"&lt;BR /&gt;&lt;BR /&gt;The shell script below does what you're looking for:&lt;BR /&gt;&lt;BR /&gt;============================================&lt;BR /&gt;#!/usr/bin/sh -x&lt;BR /&gt;ex -s inp &amp;lt;&amp;lt;-EOF&lt;BR /&gt;   g/BOB/ t /ErrorLog logs\/error_log/-1&lt;BR /&gt;   %s;/[bB][oO][bB]/;/$1/;g&lt;BR /&gt;   wq&lt;BR /&gt;EOF&lt;BR /&gt;============================================&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Sat, 09 Sep 2006 13:40:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002249#M98661</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-09T13:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002250#M98662</link>
      <description>&lt;!--!*#--&gt;Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; My Perl skills are not too good! Is there any way to do this using SED or AWK ?&lt;BR /&gt;&lt;BR /&gt;Nevertheless, does the script meet your needs?  You didn't exclude any tool from the box.  You could use 'sed' to perform the regular expression substitutions and pure shell to read lines from one file and redirect them into another, if you wish.&lt;BR /&gt;&lt;BR /&gt;The script I posted:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; verifies that three arguments are passed or dies.  Remember that the Perl holds its first argument in $ARGV[0] unlike C.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Uses the first argument as the user name variable, $name.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Uses the second argument as the name of the template file, $tempf'.  You can add or subtract lines to this file with changing the script.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Slurps (reads into a variable named $template), the whole file named in the second argument ($tempf) passed.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Replaces all matches to UUUUUU in $template with uppercase characters.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Replaces all matches to uuuuuu in $template with lowercase characters.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Uses the third argument passed to the script as the file that is to be read.  This file is read and each line therein printed to STDOUT.  If a line begins with 'ErrorLog', the $template string is printed *before* the line.  All lines in the file are printed regardless.&lt;BR /&gt;&lt;BR /&gt;If you would like to update your file in-place; that is, without redirecting the output to a file which you then rename to be that of the original input, change the first line of the script:&lt;BR /&gt;&lt;BR /&gt;...from: #/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;...to  : $/usr/bin/perl -i.old&lt;BR /&gt;&lt;BR /&gt;This will preserve a copy of the file you pass as the third argument as one with an extension of ".old" and perform an in-place modification for you.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 09 Sep 2006 14:16:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002250#M98662</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-09T14:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002251#M98663</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;From what I understand of Perl I would say it meets some of the needs. &lt;BR /&gt;&lt;BR /&gt;$template =~ s/UUUUUU/\U$name/g;&lt;BR /&gt;$template =~ s/uuuuuu/\L$name/g;&lt;BR /&gt;&lt;BR /&gt;Correct me if i am incorrect, but this will only effect the user UUUUUU. The user could be called anything though. As I said, there are nine lines before &lt;BR /&gt;ErrorLog logs/error_log that need to be changed. When I run the script I will have no idea that the user at the last block of lines is called UUUUUU. &lt;BR /&gt;&lt;BR /&gt;Should there not be a search for &lt;BR /&gt;ErrorLog logs/error_log first.&lt;BR /&gt;&lt;BR /&gt;Copy these lines to the end of the file before ErrorLog logs/error_log&lt;BR /&gt;Then do the substitution.&lt;BR /&gt;&lt;BR /&gt;So if I called the script with one parameter E.g. JOE&lt;BR /&gt;&lt;BR /&gt;Then the result would be&lt;BR /&gt;&lt;BR /&gt;Alias /BOB/block/ "/space/home/dir1/dir2/dir3/block/bob/block/"&lt;BR /&gt;Alias /BOB/doc/ "/space/home/dir1/dir2/dir3/block/bob/doc/"&lt;BR /&gt;Alias /BOB/out1/ "/space/home/dir1/dir2/dir3/block/bob/out1/"&lt;BR /&gt;Alias /BOB/out2/ "/space/home/dir1/dir2/dir3/block/bob/out2/"&lt;BR /&gt;Alias /BOB/out3/ "/space/home/dir1/dir2/dir3/block/bob/out2/out3/"&lt;BR /&gt;Alias /BOB/out4/ "/space/home/dir1/dir2/dir3/block/bob/out2/out4/"&lt;BR /&gt;Alias /BOB/test/out3/ "/space/home/dir1/dir2/dir3/block/bob/test/out3/"&lt;BR /&gt;Alias /BOB/test/out4/ "/space/home/dir1/dir2/dir3/block/bob/test/out4/"&lt;BR /&gt;Alias /BOB/out5/ "/space/home/dir1/dir2/dir3/block/bob/out5/"&lt;BR /&gt;Alias /JOE/block/ "/space/home/dir1/dir2/dir3/block/joe/block/"&lt;BR /&gt;Alias /JOE/doc/ "/space/home/dir1/dir2/dir3/block/joe/doc/"&lt;BR /&gt;Alias /JOE/out1/ "/space/home/dir1/dir2/dir3/block/joe/out1/"&lt;BR /&gt;Alias /JOE/out2/ "/space/home/dir1/dir2/dir3/block/joe/out2/"&lt;BR /&gt;Alias /JOE/out3/ "/space/home/dir1/dir2/dir3/block/joe/out2/out3/"&lt;BR /&gt;Alias /JOE/out4/ "/space/home/dir1/dir2/dir3/block/joe/out2/out4/"&lt;BR /&gt;Alias /JOE/test/out3/ "/space/home/dir1/dir2/dir3/block/joe/test/out3/"&lt;BR /&gt;Alias /JOE/test/out4/ "/space/home/dir1/dir2/dir3/block/joe/test/out4/"&lt;BR /&gt;Alias /JOE/out5/ "/space/home/dir1/dir2/dir3/block/joe/out5/"&lt;BR /&gt;ErrorLog logs/error_log&lt;BR /&gt;&lt;BR /&gt;Hope this clarifies it! :)&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Sat, 09 Sep 2006 15:38:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002251#M98663</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-09T15:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002252#M98664</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;OK, trhy this:&lt;BR /&gt;&lt;BR /&gt;# cat ./inserter&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;die "Usage: $0 newname file\n" unless $#ARGV == 1;&lt;BR /&gt;my $newname = shift;&lt;BR /&gt;my ( $oldname, $marker, @lines );&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;    $marker = $_, next if /^ErrorLog/;&lt;BR /&gt;    push @lines, $_;&lt;BR /&gt;    print;&lt;BR /&gt;}&lt;BR /&gt;for (@lines) {&lt;BR /&gt;    if (m%Alias /(.+?)/.+%) {&lt;BR /&gt;        $oldname = $1;&lt;BR /&gt;        s/$oldname/\U$newname/g;&lt;BR /&gt;        $oldname = lc($oldname);&lt;BR /&gt;        s/$oldname/\L$newname/g;&lt;BR /&gt;    }&lt;BR /&gt;    print;&lt;BR /&gt;}&lt;BR /&gt;print $marker;&lt;BR /&gt;&lt;BR /&gt;...Run as:&lt;BR /&gt;&lt;BR /&gt;# ./inserter newname file&lt;BR /&gt;&lt;BR /&gt;...where "newname" is the value of the changed name and "file" is your input file.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 09 Sep 2006 17:10:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002252#M98664</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-09T17:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002253#M98665</link>
      <description>&lt;!--!*#--&gt;Your last post clarified how the output should look like and based on that here's the script that does what you're looking for:&lt;BR /&gt;&lt;BR /&gt;============================================================&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;LcaseUser=$(awk '/^Alias/ {split($2,z,"/");l=tolower(z[2])} END {print l}' $2)&lt;BR /&gt;&lt;BR /&gt;User=$(awk '/^Alias/ {split($2,z,"/");u=z[2]} END {print u}' $2)&lt;BR /&gt;&lt;BR /&gt;ex -s $2 &amp;lt;&amp;lt;-EOF&lt;BR /&gt;   g/$User/ t /ErrorLog logs\/error_log/&lt;BR /&gt;   /ErrorLog logs\/error_log/+1,$ s;/$User/;/\U$1/;g&lt;BR /&gt;   /ErrorLog logs\/error_log/+1,$ s;/$LcaseUser/;/\L$1/;g&lt;BR /&gt;   /ErrorLog logs\/error_log/ m $&lt;BR /&gt;   wq&lt;BR /&gt;EOF&lt;BR /&gt;============================================================&lt;BR /&gt;&lt;BR /&gt;execute as...&lt;BR /&gt;&lt;BR /&gt;# &amp;lt;scriptname&amp;gt; &lt;REPLACEMENT_STRING&gt; &lt;FILE_TO_PROCESS&gt;&lt;BR /&gt;&lt;BR /&gt;for example if the scriptname is "replace" and "BOB/bob" needs to be replaced with "JOE/joe" and the file to process is "infile" then invoke as follows:&lt;BR /&gt;&lt;BR /&gt;# replace JOE infile&lt;BR /&gt;OR&lt;BR /&gt;# replace Joe infile&lt;BR /&gt;OR&lt;BR /&gt;# replace joe infile&lt;BR /&gt;&lt;BR /&gt;replacement string can be case-free as script will take care of case conversion.&lt;BR /&gt;&lt;BR /&gt;~cheers&lt;/FILE_TO_PROCESS&gt;&lt;/REPLACEMENT_STRING&gt;</description>
      <pubDate>Sun, 10 Sep 2006 02:10:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002253#M98665</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-10T02:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002254#M98666</link>
      <description>Sandman,&lt;BR /&gt;&lt;BR /&gt;For some reason your script does not do anything!&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;LcaseUser=$(awk '/^Alias/ {split($2,z,"/");l=tolower(z[2])} END {print l}' $2)&lt;BR /&gt;&lt;BR /&gt;User=$(awk '/^Alias/ {split($2,z,"/");u=z[2]} END {print u}' $2)&lt;BR /&gt;&lt;BR /&gt;ex -s $2 &amp;lt;&amp;lt;-EOF&lt;BR /&gt;   g/$User/ t /ErrorLog logs\/error_log/&lt;BR /&gt;   /ErrorLog logs\/error_log/+1,$ s;/$User/;/\U$1/;g&lt;BR /&gt;   /ErrorLog logs\/error_log/+1,$ s;/$LcaseUser/;/\L$1/;g&lt;BR /&gt;   /ErrorLog logs\/error_log/ m $&lt;BR /&gt;   wq&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am running it as follows&lt;BR /&gt;&lt;BR /&gt;./change JOE file1&lt;BR /&gt;&lt;BR /&gt;Where change is the name of the script</description>
      <pubDate>Sun, 10 Sep 2006 14:48:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002254#M98666</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-10T14:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002255#M98667</link>
      <description>I'm not sure why since it runs and produces the desired output on my machine. Did you check the contents of file1? Can you run it in debug mode and paste the output here.&lt;BR /&gt;&lt;BR /&gt;# sh -x ./change JOE file1</description>
      <pubDate>Sun, 10 Sep 2006 15:18:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002255#M98667</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-10T15:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002256#M98668</link>
      <description>&lt;!--!*#--&gt;Updated script pasted below since the earlier one made an inverse copy of the block of lines that were to be changed. Execute as follows:&lt;BR /&gt;&lt;BR /&gt;# ./change &lt;NEW_USERNAME&gt; file1&lt;BR /&gt;&lt;BR /&gt;=========================================================&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;UP=$(echo $1 | awk '{print toupper($0)}')&lt;BR /&gt;Usr=$(awk '/^Alias/ {split($2,z,"/");u=z[2]} END {print u}' $2)&lt;BR /&gt;LUsr=$(awk '/^Alias/ {split($2,z,"/");l=tolower(z[2])} END {print l}' $2)&lt;BR /&gt;&lt;BR /&gt;ex -s $2 &amp;lt;&amp;lt;-EOF&lt;BR /&gt;   g/$Usr/ t /ErrorLog logs\/error_log/&lt;BR /&gt;   /ErrorLog logs\/error_log/+1,$ s;/$Usr/;/\U$1/;g&lt;BR /&gt;   /ErrorLog logs\/error_log/+1,$ s;/$LUsr/;/\L$1/;g&lt;BR /&gt;   g/\/$UP\// m /ErrorLog logs\/error_log/&lt;BR /&gt;   /ErrorLog logs\/error_log/ m $&lt;BR /&gt;   wq&lt;BR /&gt;EOF&lt;BR /&gt;=========================================================&lt;BR /&gt;&lt;BR /&gt;hope it helps!&lt;/NEW_USERNAME&gt;</description>
      <pubDate>Sun, 10 Sep 2006 23:58:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002256#M98668</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-10T23:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002257#M98669</link>
      <description>Sandman,&lt;BR /&gt;&lt;BR /&gt;Whenever I try to run that script it gives the following error.&lt;BR /&gt;&lt;BR /&gt;./change: syntax error at line 3: `UP=$' unexpected&lt;BR /&gt;&lt;BR /&gt;Not sure where the syntax error is? &lt;BR /&gt;I have copied directly as you wrote it.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 11 Sep 2006 04:10:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002257#M98669</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-11T04:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002258#M98670</link>
      <description>What OS version are you running? Run your script in debug mode and paste the output here for troubleshooting purposes.&lt;BR /&gt;&lt;BR /&gt;# sh -x ./change&lt;BR /&gt;&lt;BR /&gt;I'ave attached the script so that there are no invisible characters inserted into the shell script when you copy it.</description>
      <pubDate>Wed, 13 Sep 2006 15:43:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002258#M98670</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-13T15:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002259#M98671</link>
      <description>Sorry about the delay. I had to modify the script slightly, as the Unix version I am running does not support the new POSIX standard that uses $() command. I used ` ` instead.&lt;BR /&gt;&lt;BR /&gt;Using cat /etc/release for OS version&lt;BR /&gt;&lt;BR /&gt;Solaris 8 &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ sh -x ./change joe test2&lt;BR /&gt;+ awk + {print toupper($0)}&lt;BR /&gt;echo joe&lt;BR /&gt;UP=joe&lt;BR /&gt;+ awk /^Alias/ {split($2,z,"/");u=z[2]} END {print u} test2&lt;BR /&gt;Usr=BOB&lt;BR /&gt;+ awk /^Alias/ {split($2,z,"/");l=tolower(z[2])} END {print l} test2&lt;BR /&gt;LUsr=BOB&lt;BR /&gt;+ ex -s test2&lt;BR /&gt;   g/BOB/ t /ErrorLog logs\/error_log/&lt;BR /&gt;   /ErrorLog logs\/error_log/+1,$ s;/BOB/;/\Ujoe/;g&lt;BR /&gt;   /ErrorLog logs\/error_log/+1,$ s;/BOB/;/\Ljoe/;g&lt;BR /&gt;   g/\/joe\// m /ErrorLog logs\/error_log/&lt;BR /&gt;   /ErrorLog logs\/error_log/ m $&lt;BR /&gt;   wq&lt;BR /&gt;Substitute pattern match failed&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Sep 2006 10:48:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002259#M98671</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-26T10:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002260#M98672</link>
      <description>Actually using:&lt;BR /&gt;&lt;BR /&gt;uname -sr &lt;BR /&gt;&lt;BR /&gt;SunOS 5.8</description>
      <pubDate>Tue, 26 Sep 2006 11:50:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002260#M98672</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-26T11:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002261#M98673</link>
      <description>Hmmm...I thought you might not be on HP-UX as the awk command on HP is the new awk (nawk) while in Solaris it is still the old awk. So in order to make it work on Solaris you have to replace all invocations of awk with nawk.&lt;BR /&gt;&lt;BR /&gt;~cheers&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Sep 2006 11:57:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002261#M98673</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-26T11:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002262#M98674</link>
      <description>Thanks. Seems to work now. Thanks for the tip regarding awk with Solaris.</description>
      <pubDate>Tue, 26 Sep 2006 12:08:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002262#M98674</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-26T12:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Challenging script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002263#M98675</link>
      <description>Sandman,&lt;BR /&gt;&lt;BR /&gt;Could you give an explanation of the following&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;g/$User/ t /ErrorLog logs\/error_log/&lt;BR /&gt;/ErrorLog logs\/error_log/+1,$ s;/$User/;/\U$1/;g&lt;BR /&gt;/ErrorLog logs\/error_log/+1,$ s;/$LcaseUser/;/\L$1/;g&lt;BR /&gt;/ErrorLog logs\/error_log/ m $&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Sep 2006 06:42:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/challenging-script/m-p/5002263#M98675</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-09-27T06:42:50Z</dc:date>
    </item>
  </channel>
</rss>

