<?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: Remving the 1st letter of  word in perl in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711610#M659919</link>
    <description>my typos:&lt;BR /&gt;&lt;BR /&gt;part after the last part --&amp;gt; part after the last slash&lt;BR /&gt;i van --&amp;gt; I can&lt;BR /&gt;&lt;BR /&gt;Your subject line indicated...&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;  Remving the 1st letter of word in perl&lt;BR /&gt;&lt;BR /&gt;Fortunately the body of the topic explained clearly what the real problem was that you were trying to solve.... retain the last 4 :-)&lt;BR /&gt;&lt;BR /&gt;If one comes looking here for either those questions, then here is one of many ways how to do that.&lt;BR /&gt;&lt;BR /&gt;remove first: $x =~ s/.//;&lt;BR /&gt;retain last 4:  $y =~ s/.*(....)/$1/&lt;BR /&gt;&lt;BR /&gt;In a working example:&lt;BR /&gt;&lt;BR /&gt;$ perl -e '$x = $y = q(abcdefgh); $x =~ s/.//; $y =~ s/.*(....)/$1/; print qq($x $y\n)'&lt;BR /&gt;&lt;BR /&gt;Other common ways to solve this and similar problems is to use the SUBSTR function, perhaps with the help of LENGTH to find where to start/end.&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;</description>
    <pubDate>Wed, 10 Nov 2010 13:50:25 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2010-11-10T13:50:25Z</dc:date>
    <item>
      <title>Remving the 1st letter of  word in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711607#M659916</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;In one of the sections in my perl script, I need to remove the 1st character of a word and store in an array.The details are ,&lt;BR /&gt;&lt;BR /&gt;The original script was ,&lt;BR /&gt;&lt;BR /&gt;if ( ! defined $inq{$node}{"dmx"} ) {&lt;BR /&gt;      print "INFO: Collecting inq disk information for DMX array on $node.\n";&lt;BR /&gt;      $command="/opt/admin/bin/inq -sym_wwn -nodots |grep dsk";&lt;BR /&gt;      my @clarinq;&lt;BR /&gt;      ($rcode, @clarinq) = execute_command($node, $command, "root");&lt;BR /&gt;      #print Dumper @clarinq;&lt;BR /&gt;      my ($ldev, $disk, $diskdevice, $line);&lt;BR /&gt;      foreach $line (@clarinq)  {&lt;BR /&gt;         ($diskdevice, $junk, $ldev, $junk) = split (/\s+/, $line);&lt;BR /&gt;         ($junk, $junk, $junk, $disk) = split (/\//, $diskdevice);&lt;BR /&gt;         #print "disk is $disk, ldev is $ldev\n";&lt;BR /&gt;         $inq{$node}{"dmx"}{$disk}=$ldev;&lt;BR /&gt;      }&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;The o/p of /opt/admin/bin/inq -sym_wwn -nodots |grep dsk is in the format,&lt;BR /&gt;&lt;BR /&gt;# /opt/admin/bin/inq -sym_wwn -nodots |grep dsk&lt;BR /&gt;/dev/rdsk/c25t0d0   000290103691   1C4D      60060480000290103691533031433444&lt;BR /&gt;&lt;BR /&gt;The 3rd column is storing to "ldev".&lt;BR /&gt;&lt;BR /&gt;In the new servers, the above inq command is not workin.We have the new command and the o/p of that command is in the format is,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ pbrun /opt/admin/bin/inq.HPUXIA64 -sym_wwn -nodots|grep disk|grep -v HP |more&lt;BR /&gt;/dev/rdisk/disk8     000290103691   0237A     60060480000290103691533032333741&lt;BR /&gt;&lt;BR /&gt;The 3rd column is of 5 digit and I want to remvoe the 1st character so that it will be in the same format as that of old servers.&lt;BR /&gt;&lt;BR /&gt;I have tried this way.....&lt;BR /&gt;if ( ! defined $inq{$node}{"dmx"} ) {&lt;BR /&gt;      print "INFO: Collecting inq disk information for DMX array on $node.\n";&lt;BR /&gt;      $command="/opt/admin/bin/inq.HPUXIA64 -sym_wwn -nodots|grep disk|grep -v HP";&lt;BR /&gt;      my @clarinq;&lt;BR /&gt;      ($rcode, @clarinq) = execute_command($node, $command, "root");&lt;BR /&gt;      #print Dumper @clarinq;&lt;BR /&gt;      my ($ldev, $disk, $ldev1, $diskdevice, $line);&lt;BR /&gt;      foreach $line (@clarinq)  {&lt;BR /&gt;         ($diskdevice, $junk, $ldev1, $junk) = split (/\s+/, $line);&lt;BR /&gt;         ($junk, $junk, $junk, $disk) = split (/\//, $diskdevice);&lt;BR /&gt;         ($junk, $ldev, $ldev, $ldev, $ldev) =split (/c/, $ldev1);=&amp;gt; This is not taking&lt;BR /&gt;         #print "disk is $disk, ldev is $ldev\n";&lt;BR /&gt;         $inq{$node}{"dmx"}{$disk}=$ldev;&lt;BR /&gt;      }&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;Please could any one help me .&lt;BR /&gt;&lt;BR /&gt;Ahilash&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Nov 2010 10:52:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711607#M659916</guid>
      <dc:creator>paabhi</dc:creator>
      <dc:date>2010-11-10T10:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Remving the 1st letter of  word in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711608#M659917</link>
      <description>&lt;!--!*#--&gt;&lt;BR /&gt;Ahilash,&lt;BR /&gt;&lt;BR /&gt;Thanks for a well presented problem.&lt;BR /&gt;The new device names are for the new 'agile', access path independent name.&lt;BR /&gt;&lt;BR /&gt;If there is a 5th digit, it might be needed at some point in time... you realize that right?&lt;BR /&gt;&lt;BR /&gt;anyway, i would suggest that instead of the repeat split you look for patterns instead.&lt;BR /&gt;&lt;BR /&gt;You want&lt;BR /&gt;$1) the part after the last part in the first word&lt;BR /&gt;$2) the last 4 hex-characters in the 3rd word. An optional leading char&lt;BR /&gt;&lt;BR /&gt;Using your 2 examples i van get that with:&lt;BR /&gt;&lt;BR /&gt;$ perl -ne 'print qq($1 $2\n) if /^.*?(\/\w+)\s+\w+\s+.?([0-9A-F]{4})\s/' x.x&lt;BR /&gt;/c25t0d0 1C4D&lt;BR /&gt;/disk8 237A&lt;BR /&gt;^.*?(\/\w+)\s+  = remember last part of first word&lt;BR /&gt;\w+\s+   = second word&lt;BR /&gt;.?([0-9A-F]{4})\s = remember 4 chars in range, followed by whitespace, with optional '?' anything char.&lt;BR /&gt;&lt;BR /&gt;In your code that can be used as:&lt;BR /&gt;&lt;BR /&gt;if (/^.*?(\/\w+)\s+\w+\s+.?([0-9A-F]{4})\s/) {&lt;BR /&gt;  $disk = $1;&lt;BR /&gt;  $ldev = $2;&lt;BR /&gt;:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Nov 2010 13:23:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711608#M659917</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-11-10T13:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Remving the 1st letter of  word in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711609#M659918</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; The 3rd column is of 5 digit and I want to remvoe the 1st character so that it will be in the same format as that of old servers.&lt;BR /&gt;&lt;BR /&gt;If I understand correctly, you want lines like:&lt;BR /&gt;&lt;BR /&gt;/dev/rdisk/disk8 000290103691 0237A 60060480000290103691533032333741&lt;BR /&gt;&lt;BR /&gt;...changed to:&lt;BR /&gt;&lt;BR /&gt;/dev/rdisk/disk8 000290103691 237A 60060480000290103691533032333741&lt;BR /&gt;&lt;BR /&gt;For this, you could do:&lt;BR /&gt;&lt;BR /&gt;# X="/dev/rdisk/disk8 000290103691 0237A 60060480000290103691533032333741"&lt;BR /&gt;# echo $X|perl -pe 's/(.+?\s)(.+?\s).(....)/$1$2$3/'&lt;BR /&gt;&lt;BR /&gt;By the way, instead of doing:&lt;BR /&gt;&lt;BR /&gt;# ($junk, $junk, $junk, $disk) = split (/\//, $diskdevice)&lt;BR /&gt;&lt;BR /&gt;...use an array slice and do:&lt;BR /&gt;&lt;BR /&gt;# $disk = (split /\//, $diskdevice)[3];&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Nov 2010 13:32:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711609#M659918</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-11-10T13:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Remving the 1st letter of  word in perl</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711610#M659919</link>
      <description>my typos:&lt;BR /&gt;&lt;BR /&gt;part after the last part --&amp;gt; part after the last slash&lt;BR /&gt;i van --&amp;gt; I can&lt;BR /&gt;&lt;BR /&gt;Your subject line indicated...&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;  Remving the 1st letter of word in perl&lt;BR /&gt;&lt;BR /&gt;Fortunately the body of the topic explained clearly what the real problem was that you were trying to solve.... retain the last 4 :-)&lt;BR /&gt;&lt;BR /&gt;If one comes looking here for either those questions, then here is one of many ways how to do that.&lt;BR /&gt;&lt;BR /&gt;remove first: $x =~ s/.//;&lt;BR /&gt;retain last 4:  $y =~ s/.*(....)/$1/&lt;BR /&gt;&lt;BR /&gt;In a working example:&lt;BR /&gt;&lt;BR /&gt;$ perl -e '$x = $y = q(abcdefgh); $x =~ s/.//; $y =~ s/.*(....)/$1/; print qq($x $y\n)'&lt;BR /&gt;&lt;BR /&gt;Other common ways to solve this and similar problems is to use the SUBSTR function, perhaps with the help of LENGTH to find where to start/end.&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Nov 2010 13:50:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remving-the-1st-letter-of-word-in-perl/m-p/4711610#M659919</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-11-10T13:50:25Z</dc:date>
    </item>
  </channel>
</rss>

