<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://www.linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Mon May 20, 2013 4:49 pm by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Mon May 20, 2013 4:49 pm</pubDate>
  <lastBuildDate>Mon May 20, 2013 4:49 pm</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://www.linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>Re: Select the last two characters from a line of output</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=16781#16781</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=162'&gt;Nigel&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Thu Feb 02, 2006 8:47 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      According to the man page for tail, the - before the number is optional ; either will count from the end of the input. If you use + instead it will count from the beginning of the input. I tend to put optional things like that in when I'm writing scripts just to make it really obvious what I mean when I come back to it months or years later &lt;img src=&quot;images/smiles/icon_wink.gif&quot; alt=&quot;Wink&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Oh, and it works on OS X as well, in case you care...</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=16781#16781</comments>
                                        <author>Nigel</author>
                                        <pubDate>Thu Feb 02, 2006 8:47 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=16781#16781</guid>
                                      </item>
                                      <item>
                                        <title>Re: Select the last two characters from a line of output</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=16778#16778</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=158'&gt;pc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Thu Feb 02, 2006 7:47 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Thanks very much it did the trick. Tried it on both on Redhat and Solaris.&lt;br /&gt;
&lt;br /&gt;
As a point of interest, looking at the tail help, I didn't see why you used the &quot;-&quot; in the &quot;-3&quot;. Tried it without, ie:&lt;br /&gt;
&lt;br /&gt;
echo 178256 | tail -c 3&lt;br /&gt;
echo 1785656 | tail -c 3&lt;br /&gt;
&lt;br /&gt;
and it worked exactly the same.&lt;br /&gt;
&lt;br /&gt;
Thank-you for you help.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=16778#16778</comments>
                                        <author>pc</author>
                                        <pubDate>Thu Feb 02, 2006 7:47 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=16778#16778</guid>
                                      </item>
                                      <item>
                                        <title>RE: Select the last two characters from a line of output</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=16751#16751</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=162'&gt;Nigel&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Feb 01, 2006 11:18 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Try this...&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;echo 178256 | tail -c -3&lt;br /&gt;
echo 1785656 | tail -c -3&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
My experiments suggest that -3 is needed to get the last 2 digits rather than -2; at first I thought it was due to the space before the pipe, but it needs it even without the space there. Perhaps it's the End-Of-Data marker ?</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=16751#16751</comments>
                                        <author>Nigel</author>
                                        <pubDate>Wed Feb 01, 2006 11:18 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=16751#16751</guid>
                                      </item>
                                      <item>
                                        <title>Select the last two characters from a line of output</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=16746#16746</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=158'&gt;pc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Feb 01, 2006 10:13 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I was hoping, using a simple pipe and unix command, to be able to cut the last two characters off a line.&lt;br /&gt;
&lt;br /&gt;
example output: 178256&lt;br /&gt;
required output: 56&lt;br /&gt;
&lt;br /&gt;
I thought of using the cut command, but can only seem to specify characters from the start of the line. The line is not always the same number of characters.&lt;br /&gt;
&lt;br /&gt;
echo 178256 | cut -c5-&lt;br /&gt;
  will give 56&lt;br /&gt;
as will&lt;br /&gt;
echo 178256 | cut -c5-6&lt;br /&gt;
&lt;br /&gt;
but will be incorrect if the say the number was 1785656.&lt;br /&gt;
&lt;br /&gt;
Any suggestions welcome. I am sure there must be a way, there usually is, without having to write a script.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=16746#16746</comments>
                                        <author>pc</author>
                                        <pubDate>Wed Feb 01, 2006 10:13 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=16746#16746</guid>
                                      </item></channel></rss>