<?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: use of cut in command in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937830#M58892</link>
    <description>&lt;P&gt;Thanks Steven for the reply.&lt;/P&gt;&lt;P&gt;I also found out that there is an unprintable character (CR - ASCII 13) at the end of "false" in the file&amp;nbsp;so I still need to use cut to get only the first 5 characters.&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;$ x=$(grep -i end x.x | tr -s " " | cut -d "=" -f 2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;$ echo $x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;false&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;$ expr length $x&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;6&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;$ x1=$(echo $x | cut -c1-5)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;$ echo $x1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;false&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;$ expr length $x1&lt;BR /&gt;5&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2017 05:58:50 GMT</pubDate>
    <dc:creator>Gesmundo</dc:creator>
    <dc:date>2017-02-07T05:58:50Z</dc:date>
    <item>
      <title>use of cut in command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937364#M58890</link>
      <description>&lt;P&gt;Can anybody see the issue?&lt;BR /&gt;I have the following commands:&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT color="#0000ff"&gt;$ x3=$(grep -i isend x.x | tr -s " " )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;$ echo $x3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;isEndOfStream = false&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;$ x3=$(grep -i isend x.x | tr -s " " | cut -d "=" -f 2 )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;$ echo $x3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;false&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;$ x3=$(grep -i isend x.x | tr -s " " | cut -d "=" -f 2 | cut -c1-5)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;$ echo $x3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;fals&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Where is 'e'?&lt;BR /&gt;&lt;BR /&gt;But if I further do this:&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;$ x4=$(echo $x3)&lt;BR /&gt;$ echo $x4&lt;BR /&gt;false&lt;BR /&gt;$ x4=$(echo $x3 | cut -c1-5)&lt;BR /&gt;$ echo $x4&lt;BR /&gt;false&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;I got the whole value (false).&lt;BR /&gt;Thanks for any explanation and workaround.&lt;/P&gt;&lt;P&gt;Noel&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 04:41:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937364#M58890</guid>
      <dc:creator>Gesmundo</dc:creator>
      <dc:date>2017-02-06T04:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: use of cut in command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937367#M58891</link>
      <description>&lt;P&gt;&amp;gt; Where is 'e'?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Your "cut -c1-5" command cut it off from " false".&lt;BR /&gt;&lt;BR /&gt;pro3$ x3='isEndOfStream = false'&lt;BR /&gt;pro3$ echo "$x3" | cut -d "=" -f 2&lt;BR /&gt;&amp;nbsp;false&lt;BR /&gt;&lt;BR /&gt;(Note: " false" != "false".)&lt;BR /&gt;&lt;BR /&gt;pro3$ x='&amp;nbsp;&amp;nbsp; xxx&amp;nbsp;&amp;nbsp; '&lt;BR /&gt;&lt;BR /&gt;pro3$ echo $x&lt;BR /&gt;xxx&lt;BR /&gt;&lt;BR /&gt;pro3$ echo "$x"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; xxx&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Guess which one works more like what happens in your pipeline.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; As for a work-around, it depends on how you'd like to get rid of that&lt;BR /&gt;extra space.&amp;nbsp; As usual, many things are possible (once you see the extra&lt;BR /&gt;space).&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 05:33:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937367#M58891</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2017-02-06T05:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: use of cut in command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937830#M58892</link>
      <description>&lt;P&gt;Thanks Steven for the reply.&lt;/P&gt;&lt;P&gt;I also found out that there is an unprintable character (CR - ASCII 13) at the end of "false" in the file&amp;nbsp;so I still need to use cut to get only the first 5 characters.&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;$ x=$(grep -i end x.x | tr -s " " | cut -d "=" -f 2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;$ echo $x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;false&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;$ expr length $x&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;6&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;$ x1=$(echo $x | cut -c1-5)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;$ echo $x1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;false&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;$ expr length $x1&lt;BR /&gt;5&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 05:58:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937830#M58892</guid>
      <dc:creator>Gesmundo</dc:creator>
      <dc:date>2017-02-07T05:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: use of cut in command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937839#M58893</link>
      <description>&lt;P&gt;&amp;gt; I also found out that there is an unprintable character (CR - ASCII&lt;BR /&gt;&amp;gt; 13) at the end of "false" in the file so I still need to use cut to get&lt;BR /&gt;&amp;gt; only the first 5 characters.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; You're already using "tr", so it'd be easy to have it translate a CR&lt;BR /&gt;("\r") into something more harmless, like, say, a space.&amp;nbsp; And, of&lt;BR /&gt;course, "sed" can destroy spaces with ease:&lt;BR /&gt;&lt;BR /&gt;mba$ x='&amp;nbsp;&amp;nbsp; xxx&amp;nbsp;&amp;nbsp; '&lt;BR /&gt;mba$ echo "$x"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; xxx&amp;nbsp; &amp;nbsp;&lt;BR /&gt;mba$ echo "$x" | sed -e 's/ //g'&lt;BR /&gt;xxx&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If you really want exactly five characters, then "cut" is fine, but&lt;BR /&gt;if you want to trim off spaces and other junk, then counting characters&lt;BR /&gt;may not be the best way.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 06:37:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/use-of-cut-in-command/m-p/6937839#M58893</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2017-02-07T06:37:49Z</dc:date>
    </item>
  </channel>
</rss>

