<?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: Question regarding cat...... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573602#M228602</link>
    <description>var='SanNonMAR2005'&lt;BR /&gt;echo ${var#SanNon}&lt;BR /&gt;echo ${var%MAR*}&lt;BR /&gt;&lt;BR /&gt;Anil</description>
    <pubDate>Wed, 29 Jun 2005 16:01:07 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2005-06-29T16:01:07Z</dc:date>
    <item>
      <title>Question regarding cat......</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573600#M228600</link>
      <description>I need to build the command:  cat SanNon1MAR2005.txt SanNon2MAR2005.txt &amp;gt; SanNonMAR2005&lt;BR /&gt;when given a variable containing "SanNonMAR2005".   And that's all we have to work with.&lt;BR /&gt;&lt;BR /&gt;I need to split the contents of the variable into 2 pieces (SanNon) and (MAR2005) and insert a "1" and a "2" where necessary to build the stmt above.&lt;BR /&gt;&lt;BR /&gt;If InputFile is my variable then  'echo $Inputfile | cut -c1-6'  would give me SanNon.   That's about as far as I've gotten....&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jun 2005 15:46:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573600#M228600</guid>
      <dc:creator>Joe Profaizer</dc:creator>
      <dc:date>2005-06-29T15:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding cat......</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573601#M228601</link>
      <description>There are many ways to do this and if you look at an earlier patterm matching thread today you would get some good Perl ideas but to fix your approach:&lt;BR /&gt;&lt;BR /&gt;PT1=$(echo "${Inputfile}" | cut -c1-6)&lt;BR /&gt;PT2=$(echo "${Inputfile}" | cut -c7-)&lt;BR /&gt;&lt;BR /&gt;V1="${PT1}1${PT2}"&lt;BR /&gt;echo "V1 = ${V1}"&lt;BR /&gt;V2="${PT1}2${PT2}"&lt;BR /&gt;echo "V2 = ${V2}"&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jun 2005 16:00:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573601#M228601</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-06-29T16:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding cat......</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573602#M228602</link>
      <description>var='SanNonMAR2005'&lt;BR /&gt;echo ${var#SanNon}&lt;BR /&gt;echo ${var%MAR*}&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Wed, 29 Jun 2005 16:01:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573602#M228602</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-06-29T16:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding cat......</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573603#M228603</link>
      <description>Joe,&lt;BR /&gt;&lt;BR /&gt;Here's what you are looking for:&lt;BR /&gt;=============================================&lt;BR /&gt;Inputfile=SanNonMAR2005&lt;BR /&gt;&lt;BR /&gt;echo $Inputfile | awk -F"M" 'BEGIN{OFS="M"} {print $1"1",$2}'&lt;BR /&gt;=============================================&lt;BR /&gt;&lt;BR /&gt;the above code will give you "SanNon1MAR2005.txt". Replace the "1" in the awk command with the appropriate number (say 2) to build your cat command.&lt;BR /&gt;&lt;BR /&gt;hope this helps!</description>
      <pubDate>Wed, 29 Jun 2005 16:02:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573603#M228603</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-06-29T16:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding cat......</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573604#M228604</link>
      <description>As I mentionioned earlier Perl is really the way to go for pattern matching.&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;-----------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset -i STAT=1&lt;BR /&gt;typeset FNAME=''&lt;BR /&gt;typeset PT1=''&lt;BR /&gt;typeset MON=''&lt;BR /&gt;typeset YR=''&lt;BR /&gt;while [[ ${STAT} -ne 0 ]]&lt;BR /&gt;  do&lt;BR /&gt;    echo "Enter Filename: \c"&lt;BR /&gt;    read FNAME&lt;BR /&gt;    perl -e 'if ($ARGV[0] =~ /(.+)(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(\d{4})$/ ) { printf ("%s\t%s\t%s\n",$1,$2,$3); exit(0); } else { exit(1); }' "${FNAME}" | read PT1 MON YR&lt;BR /&gt;    STAT=${?}&lt;BR /&gt;    if [[ ${STAT} -ne 0 ]]&lt;BR /&gt;      then&lt;BR /&gt;        echo "Bad Format: FnameMONYYYY" &amp;gt;&amp;amp;2&lt;BR /&gt;      fi&lt;BR /&gt;  done&lt;BR /&gt;typeset CMD="cat ${PT1}1${MON}${YR}.txt ${PT1}2${MON}${YR}.txt &amp;gt; \&lt;BR /&gt;${PT1}${MON}${YR}"&lt;BR /&gt;echo "Cmd = \"${CMD}\""&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;---------------------------------------&lt;BR /&gt;&lt;BR /&gt;Note: The perl command including the read PT1 MON YR is all one line. The power of this approach is that it actually checks your filename for valid composition (valid monthname, 4 digit year). I've looked this over carefully and it should work. so that all you need to do is ${CMD} to actually exucute the built-up string.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jun 2005 17:09:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573604#M228604</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-06-29T17:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding cat......</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573605#M228605</link>
      <description>You can use awk for this. &lt;BR /&gt;&lt;BR /&gt;echo $InputFile | awk '{ printf("%s1%s2", substr($0, 1, 6), substr($0, 7));}'&lt;BR /&gt;-Amit</description>
      <pubDate>Wed, 29 Jun 2005 23:49:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573605#M228605</guid>
      <dc:creator>Amit Agarwal_1</dc:creator>
      <dc:date>2005-06-29T23:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding cat......</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573606#M228606</link>
      <description>The "cat" command can be constructed with the awk excerpt given below:&lt;BR /&gt;&lt;BR /&gt;==============================================================&lt;BR /&gt;# export InputFile="SanNonMAR2005"&lt;BR /&gt;&lt;BR /&gt;# echo $Inputfile | awk -F"M" '{system("cat "$1"1M"$2".txt "$1"2M"$2".txt &amp;gt; "$0)}'&lt;BR /&gt;==============================================================&lt;BR /&gt;&lt;BR /&gt;This will execute the code you want, i.e.&lt;BR /&gt;&lt;BR /&gt;# cat SanNon1MAR2005.txt SanNon2MAR2005.txt &amp;gt; SanNonMAR2005&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Jun 2005 02:49:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-cat/m-p/3573606#M228606</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-06-30T02:49:12Z</dc:date>
    </item>
  </channel>
</rss>

