<?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: [Q] simple shell command question .. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798530#M782201</link>
    <description>Update to my last post as I forgot to include the conditional evaluation that the string should start with an "m" and should have exactly nine characters.&lt;BR /&gt;&lt;BR /&gt;sed way...&lt;BR /&gt;&lt;BR /&gt;# sed -n '/^m.\{8\}$/ s/\(.*\).$/\1/p' test.txt&lt;BR /&gt;&lt;BR /&gt;awk way...&lt;BR /&gt;&lt;BR /&gt;# awk '$0~/^m/ &amp;amp;&amp;amp; length($0)==9 {sub(/.$/,"");print $0}' test.txt&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
    <pubDate>Thu, 01 Jun 2006 11:04:10 GMT</pubDate>
    <dc:creator>Sandman!</dc:creator>
    <dc:date>2006-06-01T11:04:10Z</dc:date>
    <item>
      <title>[Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798523#M782194</link>
      <description>I would like to split some characters that have a 9 digit, and same character - 1 "m", 8 numeric characters such as &lt;BR /&gt;$ cat test.txt&lt;BR /&gt;m12345678&lt;BR /&gt;m76543210&lt;BR /&gt;m09876543&lt;BR /&gt;m98765432&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;I would like to split this 9 digit to 8 digit.&lt;BR /&gt;(want to remove last character such as &lt;BR /&gt;m1234567&lt;BR /&gt;m7654321&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Would you recommand any command to do this ?&lt;BR /&gt;like awk, sed etc ...&lt;BR /&gt;&lt;BR /&gt;I am not sure what option is available to this at awk.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jun 2006 07:47:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798523#M782194</guid>
      <dc:creator>Tony, Lim</dc:creator>
      <dc:date>2006-06-01T07:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798524#M782195</link>
      <description>What about the cut command?  Man cut for details.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 01 Jun 2006 07:49:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798524#M782195</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2006-06-01T07:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798525#M782196</link>
      <description>Hi Tony:&lt;BR /&gt;&lt;BR /&gt;TMTOWTDI (There's More Than One Way To Do It).  Here's one using shell commands and 'cut':&lt;BR /&gt;&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt;    echo ${LINE}|cut -c1-8&lt;BR /&gt;done &amp;lt; filein &amp;gt; fileout&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 Jun 2006 07:53:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798525#M782196</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-06-01T07:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798526#M782197</link>
      <description>cut -c1-8 test.txt &amp;gt; output.txt</description>
      <pubDate>Thu, 01 Jun 2006 07:53:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798526#M782197</guid>
      <dc:creator>Luk Vandenbussche</dc:creator>
      <dc:date>2006-06-01T07:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798527#M782198</link>
      <description>Hi (again) Tony:&lt;BR /&gt;&lt;BR /&gt;For fun, and brevity, you could do:&lt;BR /&gt;&lt;BR /&gt;# perl -pli.old -e 'chop' file&lt;BR /&gt;&lt;BR /&gt;This reads and chops the last character of every line (which is what you wanted); makes a backup copy of your input file as "file.old" and replaces "file" with the modified copy.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 Jun 2006 07:57:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798527#M782198</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-06-01T07:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798528#M782199</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;don't know what your statement about 'm' means - I guess only strings starting with 'm' and length 9 should be modified.&lt;BR /&gt;&lt;BR /&gt;awk '$1 ~ /^m/ &amp;amp;&amp;amp; length($1)==9 {print substr($1,1,8);next}&lt;BR /&gt;{print}' test.txt&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 01 Jun 2006 08:55:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798528#M782199</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-06-01T08:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798529#M782200</link>
      <description>How about giving sed a try...&lt;BR /&gt;&lt;BR /&gt;# sed '/^m/s/\(.*\).$/\1/g' test.txt&lt;BR /&gt;&lt;BR /&gt;OR with awk as...&lt;BR /&gt;&lt;BR /&gt;# awk '{sub(/.$/,"");print $0}' test.txt&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Thu, 01 Jun 2006 10:45:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798529#M782200</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-06-01T10:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798530#M782201</link>
      <description>Update to my last post as I forgot to include the conditional evaluation that the string should start with an "m" and should have exactly nine characters.&lt;BR /&gt;&lt;BR /&gt;sed way...&lt;BR /&gt;&lt;BR /&gt;# sed -n '/^m.\{8\}$/ s/\(.*\).$/\1/p' test.txt&lt;BR /&gt;&lt;BR /&gt;awk way...&lt;BR /&gt;&lt;BR /&gt;# awk '$0~/^m/ &amp;amp;&amp;amp; length($0)==9 {sub(/.$/,"");print $0}' test.txt&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Thu, 01 Jun 2006 11:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798530#M782201</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-06-01T11:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798531#M782202</link>
      <description>Yet another oops! as the string should have exactly nine characters, starting with "m" and followed by eight numerics...so here's the final version:&lt;BR /&gt;&lt;BR /&gt;sed version...&lt;BR /&gt;&lt;BR /&gt;# sed -n '/^m[0-9]\{8\}$/ s/\(.*\).$/\1/p' test.txt&lt;BR /&gt;&lt;BR /&gt;awk version...&lt;BR /&gt;&lt;BR /&gt;# awk '$0~/^m[0-9]{8}$/ {sub(/.$/,"");print $0}' test.txt&lt;BR /&gt;&lt;BR /&gt;hope it helps!!!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jun 2006 11:28:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798531#M782202</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-06-01T11:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] simple shell command question ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798532#M782203</link>
      <description>just do it in the shell:&lt;BR /&gt;&lt;BR /&gt;while read var restOfLine&lt;BR /&gt;do&lt;BR /&gt;print "${var%?}"&lt;BR /&gt;done &amp;lt; yourFile</description>
      <pubDate>Thu, 01 Jun 2006 21:36:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/q-simple-shell-command-question/m-p/3798532#M782203</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2006-06-01T21:36:58Z</dc:date>
    </item>
  </channel>
</rss>

