<?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: removing the last character from fuser in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076499#M92287</link>
    <description>The following will work for your specific case. You can't just drop the last character because it's possible to have multiple letters after the PID in fuser output. The first regexp eliminates the alpha characters (leaving the PIDs and a mangled path) and the second regexp eliminates the mangled path (leaving only the PIDs as the final output).&lt;BR /&gt;&lt;BR /&gt;fuser -c /data 2&amp;gt;&amp;amp;1 | sed -e 's/[a-z]//g' -e 's/[^0-9[:blank:]]//g'</description>
    <pubDate>Fri, 26 Oct 2007 08:56:18 GMT</pubDate>
    <dc:creator>Jeff_Traigle</dc:creator>
    <dc:date>2007-10-26T08:56:18Z</dc:date>
    <item>
      <title>removing the last character from fuser</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076497#M92285</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I am working on AIX and run fuser, I get several procs with 1234c 234344c 34445c&lt;BR /&gt;&lt;BR /&gt;how can I script to loose the last character, I'd like to know how to drop any final character for otheer scripting purposes.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Fri, 26 Oct 2007 08:36:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076497#M92285</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-10-26T08:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: removing the last character from fuser</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076498#M92286</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;You could do something like this:&lt;BR /&gt;&lt;BR /&gt;# echo "abc123"|awk '{print substr $0,0,length($0)-1)}'&lt;BR /&gt;&lt;BR /&gt;abc12&lt;BR /&gt;&lt;BR /&gt;This trims the last character of any string.&lt;BR /&gt;&lt;BR /&gt;In Perl:&lt;BR /&gt;&lt;BR /&gt;# echo "abc123"|perl -ple 'chop'&lt;BR /&gt;abc12&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 26 Oct 2007 08:53:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076498#M92286</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-10-26T08:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: removing the last character from fuser</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076499#M92287</link>
      <description>The following will work for your specific case. You can't just drop the last character because it's possible to have multiple letters after the PID in fuser output. The first regexp eliminates the alpha characters (leaving the PIDs and a mangled path) and the second regexp eliminates the mangled path (leaving only the PIDs as the final output).&lt;BR /&gt;&lt;BR /&gt;fuser -c /data 2&amp;gt;&amp;amp;1 | sed -e 's/[a-z]//g' -e 's/[^0-9[:blank:]]//g'</description>
      <pubDate>Fri, 26 Oct 2007 08:56:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076499#M92287</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2007-10-26T08:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: removing the last character from fuser</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076500#M92288</link>
      <description>&lt;!--!*#--&gt;Funny, the others haven't observed this.&lt;BR /&gt;Simply redirect stderr to /dev/null.&lt;BR /&gt;This strips everything apart from the PIDs.&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;# fuser -c /oracle 2&amp;gt;/dev/null&lt;BR /&gt;   15385   15488   15392   15487   15405   15388   15407   12205   15418   15406   15410   15420&lt;BR /&gt;   15372    2676   15404   15386&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;This is handy if you want to use the PIDs in situ.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# ps -p "$(fuser -c /oracle 2&amp;gt;/dev/null)"&lt;BR /&gt;ps: wrong PID number &lt;BR /&gt;   PID TTY       TIME COMMAND&lt;BR /&gt; 15385 ?        430:55 disp+work&lt;BR /&gt; 15488 ?        533:41 jlaunch&lt;BR /&gt; 15392 ?        11:15 disp+work&lt;BR /&gt; 15487 ?        84:04 jlaunch&lt;BR /&gt; 15405 ?         0:05 disp+work&lt;BR /&gt; 15388 ?        595:17 disp+work&lt;BR /&gt; 15407 ?         0:03 disp+work&lt;BR /&gt; 12205 ?         3:39 disp+work&lt;BR /&gt; 15418 ?         6:15 disp+work&lt;BR /&gt; 15406 ?         0:00 disp+work&lt;BR /&gt; 15410 ?         0:00 disp+work&lt;BR /&gt; 15420 ?         0:00 disp+work&lt;BR /&gt; 15372 ?         7:00 disp+work&lt;BR /&gt;  2676 ?         0:00 disp+work&lt;BR /&gt; 15404 ?         1:35 disp+work&lt;BR /&gt; 15386 ?        49:07 disp+work&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Oct 2007 09:05:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076500#M92288</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2007-10-26T09:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: removing the last character from fuser</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076501#M92289</link>
      <description>I almost did... I just wasn't awake enough yet to realize it. :)</description>
      <pubDate>Fri, 26 Oct 2007 09:06:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076501#M92289</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2007-10-26T09:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: removing the last character from fuser</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076502#M92290</link>
      <description>Hi (again) Chris:&lt;BR /&gt;&lt;BR /&gt;Thanks, Ralph, I too remembered that when I actually executed 'fuser'.&lt;BR /&gt;&lt;BR /&gt;By the way, Chris, Perl allows a negative value for the length parameter to 'substr'.  Using a negative value for length trims that many characters from the end.  For example:&lt;BR /&gt;&lt;BR /&gt;# echo abc123|perl -nle 'print substr($_,0,-1)'&lt;BR /&gt;&lt;BR /&gt;abc12&lt;BR /&gt;&lt;BR /&gt;Thus, there's yet another way to do this.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 26 Oct 2007 09:25:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076502#M92290</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-10-26T09:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: removing the last character from fuser</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076503#M92291</link>
      <description>ok thanks again chaps,&lt;BR /&gt;&lt;BR /&gt;as always plenty of ways of killing a bird with many stones!&lt;BR /&gt;&lt;BR /&gt;:-)&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Fri, 26 Oct 2007 10:23:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-the-last-character-from-fuser/m-p/5076503#M92291</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-10-26T10:23:14Z</dc:date>
    </item>
  </channel>
</rss>

