<?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: Cheap points for script gurus !!  ;p in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577354#M920045</link>
    <description>This may seem cheesy but how about something like this&lt;BR /&gt;&lt;BR /&gt;grep  "^........R200.*" testfile&lt;BR /&gt;&lt;BR /&gt;where you pad out the dots till the first occurance of R200 (the dot, '.', represents any character).  You could do the same for T200.  Not the most elegant solution, but it works.&lt;BR /&gt;&lt;BR /&gt;-Santosh</description>
    <pubDate>Mon, 10 Sep 2001 17:20:00 GMT</pubDate>
    <dc:creator>Santosh Nair_1</dc:creator>
    <dc:date>2001-09-10T17:20:00Z</dc:date>
    <item>
      <title>Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577347#M920038</link>
      <description>Hey gurus,&lt;BR /&gt;&lt;BR /&gt;I have a file that I know will contain these values at a FIXED position:&lt;BR /&gt;&lt;BR /&gt;T200&lt;BR /&gt;R200&lt;BR /&gt;&lt;BR /&gt;I want to split this one file into two separate files. One file containing the T200's and one file containing the R200's.&lt;BR /&gt;&lt;BR /&gt;Now, this would be a piece of cake had it not been for the fact that T200 could also appear on "R200-lines" and vice versa. The only thing that will help me is the fact that the T200's and R200's do infact come atleast once and in the exact same spot each time.&lt;BR /&gt;&lt;BR /&gt;Examples:&lt;BR /&gt;&lt;BR /&gt;FileA without problem:&lt;BR /&gt;sometextT200sometextheretoo&lt;BR /&gt;sometextR200sometextheretoo&lt;BR /&gt;sometextR200sometextheretoo&lt;BR /&gt;sometextT200sometextheretoo&lt;BR /&gt;sometextR200sometextheretoo&lt;BR /&gt;sometextR200sometextheretoo&lt;BR /&gt;&lt;BR /&gt;FileB with problem:&lt;BR /&gt;sometextT200sometextheretoo&lt;BR /&gt;sometextR200sometextherT200&lt;BR /&gt;sometextR200sometextheretoo&lt;BR /&gt;sometextT200sometextherR200&lt;BR /&gt;sometextR200sometextheretoo&lt;BR /&gt;sometextR200sometextheretoo&lt;BR /&gt;&lt;BR /&gt;see my problem ?&lt;BR /&gt;&lt;BR /&gt;Please help !!??</description>
      <pubDate>Mon, 10 Sep 2001 16:51:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577347#M920038</guid>
      <dc:creator>kent friberg</dc:creator>
      <dc:date>2001-09-10T16:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577348#M920039</link>
      <description>Can you show us an example of the output you expect in both cases?  I am confused about the format of the output file that you want.</description>
      <pubDate>Mon, 10 Sep 2001 17:02:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577348#M920039</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-09-10T17:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577349#M920040</link>
      <description>&lt;P&gt;Hi Kent:&lt;BR /&gt;&lt;BR /&gt;Attached is a shell script which calls awk. You will need to adjust the shell variable "OFFSET" to match the fixed location of your data.&lt;BR /&gt;&lt;BR /&gt;Clay&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 06:21:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577349#M920040</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2024-07-04T06:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577350#M920041</link>
      <description>ahhh.yes..&lt;BR /&gt;&lt;BR /&gt;OriginalFileA without problem: &lt;BR /&gt;sometextT200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextT200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;&lt;BR /&gt;I want to be split into two files like this:&lt;BR /&gt;&lt;BR /&gt;File1&lt;BR /&gt;sometextT200sometextheretoo &lt;BR /&gt;sometextT200sometextheretoo &lt;BR /&gt;&lt;BR /&gt;File2&lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;&lt;BR /&gt;(and same with)&lt;BR /&gt;OriginalFileB with problem: &lt;BR /&gt;sometextT200sometextheretoo &lt;BR /&gt;sometextR200sometextherT200 &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextT200sometextherR200 &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;&lt;BR /&gt;I want split into:&lt;BR /&gt;&lt;BR /&gt;File1:&lt;BR /&gt;sometextT200sometextheretoo &lt;BR /&gt;sometextT200sometextherR200 &lt;BR /&gt;&lt;BR /&gt;File2:&lt;BR /&gt;sometextR200sometextherT200 &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;sometextR200sometextheretoo &lt;BR /&gt;&lt;BR /&gt;Hope this was not too fuzzy .. ?:-\</description>
      <pubDate>Mon, 10 Sep 2001 17:13:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577350#M920041</guid>
      <dc:creator>kent friberg</dc:creator>
      <dc:date>2001-09-10T17:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577351#M920042</link>
      <description>Hi Kent:&lt;BR /&gt;Oops wrong one, this should do it.&lt;BR /&gt;&lt;BR /&gt;Attached is a shell script which calls awk. You will need to adjust the shell variable "OFFSET" to match the fixed location of your data.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Mon, 10 Sep 2001 17:13:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577351#M920042</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-09-10T17:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577352#M920043</link>
      <description>OK Kent,&lt;BR /&gt;&lt;BR /&gt;I am not a guru but will try to help. This is really dependent on what your fixed position is. If you can show us the exact files, it may be easy to figure out.&lt;BR /&gt;&lt;BR /&gt;If we just take the example you gave, i would do this way.&lt;BR /&gt;&lt;BR /&gt;For ex., if you have the text like this&lt;BR /&gt;sometextT200sometextR200&lt;BR /&gt;sometextT200sometextT200&lt;BR /&gt;sometextR200sometextT200&lt;BR /&gt;&lt;BR /&gt;If I want to get all T200 lines I would do&lt;BR /&gt;&lt;BR /&gt;grep "^sometextT200" file &amp;gt; t200.stuff&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If there is anything that is before the fixed position, then you can use that string in your grep command.&lt;BR /&gt;&lt;BR /&gt;If it is a fixed field, you can use awk to match that field and print the line.&lt;BR /&gt;&lt;BR /&gt;It's just dependent on what you have in the file.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Mon, 10 Sep 2001 17:14:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577352#M920043</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-09-10T17:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577353#M920044</link>
      <description>This may be simplistic, but what about grep?&lt;BR /&gt;&lt;BR /&gt;grep T200 file1 &amp;gt;&amp;gt; T200.out&lt;BR /&gt;grep R200 file1 &amp;gt;&amp;gt; R200.out&lt;BR /&gt;&lt;BR /&gt;That will pick up all occurrences of T200 and R200 in the file.</description>
      <pubDate>Mon, 10 Sep 2001 17:18:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577353#M920044</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-09-10T17:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577354#M920045</link>
      <description>This may seem cheesy but how about something like this&lt;BR /&gt;&lt;BR /&gt;grep  "^........R200.*" testfile&lt;BR /&gt;&lt;BR /&gt;where you pad out the dots till the first occurance of R200 (the dot, '.', represents any character).  You could do the same for T200.  Not the most elegant solution, but it works.&lt;BR /&gt;&lt;BR /&gt;-Santosh</description>
      <pubDate>Mon, 10 Sep 2001 17:20:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577354#M920045</guid>
      <dc:creator>Santosh Nair_1</dc:creator>
      <dc:date>2001-09-10T17:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577355#M920046</link>
      <description>Clay's solution should work, though I personally would have included the output to each file within the awk program.  Under the header of "there's always another way", how about using basic shell commands.&lt;BR /&gt;&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt;   KEY=$(echo $LINE |cut -c 0-12)&lt;BR /&gt;   case $KEY in&lt;BR /&gt;   T200)&lt;BR /&gt;       echo $LINE &amp;gt;&amp;gt; file1&lt;BR /&gt;       ;;&lt;BR /&gt;   R200)&lt;BR /&gt;       echo $LINE &amp;gt;&amp;gt; file2&lt;BR /&gt;   *)&lt;BR /&gt;       ;;&lt;BR /&gt;   esac&lt;BR /&gt;done &amp;lt; infile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you know that every line MUST have either R200 or T200 in the key position, drop the case and just use an if..then..else</description>
      <pubDate>Mon, 10 Sep 2001 17:30:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577355#M920046</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2001-09-10T17:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577356#M920047</link>
      <description>You already have lots of answers, but here is another one attached to this reply.</description>
      <pubDate>Mon, 10 Sep 2001 17:37:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577356#M920047</guid>
      <dc:creator>Duane Gorder</dc:creator>
      <dc:date>2001-09-10T17:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577357#M920048</link>
      <description>Hi Kent,&lt;BR /&gt;&lt;BR /&gt;I was about to send in the reply when i saw Alan's reply which was almost what i was submitting anyway.&lt;BR /&gt;&lt;BR /&gt;I only had a small modification to that , since you already know the exact location, you want to use&lt;BR /&gt;cut -c 9-12 for the example you gave.&lt;BR /&gt;where 9 is the beginning and 12 is the end. (man cut for more information)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Ramesh</description>
      <pubDate>Mon, 10 Sep 2001 18:25:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577357#M920048</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-09-10T18:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577358#M920049</link>
      <description>Hi Kent,&lt;BR /&gt;&lt;BR /&gt;   I agree with  both Patrick and Sridhar's solutions, they r simple and good. I don't think u need to go for spl scripts for that.&lt;BR /&gt;&lt;BR /&gt;Cheers...&lt;BR /&gt;Satish.</description>
      <pubDate>Mon, 10 Sep 2001 18:42:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577358#M920049</guid>
      <dc:creator>Satish Y</dc:creator>
      <dc:date>2001-09-10T18:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577359#M920050</link>
      <description>Hello Kent,&lt;BR /&gt;&lt;BR /&gt;Santosh's answer is almost perfect, the only &lt;BR /&gt;improvement I can see is the omit ".*" at the&lt;BR /&gt;end of his pattern - it is not needed there.&lt;BR /&gt;&lt;BR /&gt;Just my ?0.02,&lt;BR /&gt;Wodisch (I am european, but that should be about $0.02)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 10 Sep 2001 19:42:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577359#M920050</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2001-09-10T19:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577360#M920051</link>
      <description>Hi Kent,&lt;BR /&gt;&lt;BR /&gt;i would use no awk or perl, just a little bit grep:&lt;BR /&gt;&lt;BR /&gt;grep "^........T200" &amp;gt;&amp;gt; t200.txt&lt;BR /&gt;grep "^........R200" &amp;gt;&amp;gt; r200.txt&lt;BR /&gt;&lt;BR /&gt;Put in as many dots as you need as a placeholder for your fixed length Text befor your T200/R200 string. This grep says: grep every line starting with 8 characters of any type and the string T200. And don't care whats behind.&lt;BR /&gt;&lt;BR /&gt;This is not a impressing solution, but it is working and really fast.&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Regards Stefan</description>
      <pubDate>Tue, 11 Sep 2001 05:38:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577360#M920051</guid>
      <dc:creator>Stefan Schulz</dc:creator>
      <dc:date>2001-09-11T05:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577361#M920052</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;here my solution:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;:&amp;gt;File1&lt;BR /&gt;:&amp;gt;File2&lt;BR /&gt;&lt;BR /&gt;awk '{&lt;BR /&gt;t=index($0, "T200")&lt;BR /&gt;r=index($0, "R200")&lt;BR /&gt;if(t&amp;gt;0)&lt;BR /&gt;{&lt;BR /&gt;  if((r&amp;gt;0 &amp;amp;&amp;amp; t&lt;R&gt;&lt;/R&gt;    print $0 &amp;gt;&amp;gt;"File1";&lt;BR /&gt;  else&lt;BR /&gt;    print $0 &amp;gt;&amp;gt;"File2";&lt;BR /&gt;}&lt;BR /&gt;else if(r&amp;gt;0)&lt;BR /&gt;{&lt;BR /&gt;  if((t&amp;gt;0 &amp;amp;&amp;amp; r&lt;T&gt;&lt;/T&gt;    print $0 &amp;gt;&amp;gt;"File2";&lt;BR /&gt;  else&lt;BR /&gt;    print $0 &amp;gt;&amp;gt;"File1";&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}' File&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Sep 2001 06:04:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577361#M920052</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2001-09-11T06:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cheap points for script gurus !!  ;p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577362#M920053</link>
      <description>Huge thanks guys, &lt;BR /&gt;&lt;BR /&gt;I hope I've given everyone points now.&lt;BR /&gt;&lt;BR /&gt;ohh..btw:&lt;BR /&gt;&lt;BR /&gt;grep "^........T200" &lt;BR /&gt;&lt;BR /&gt;did the trick...&lt;BR /&gt;&lt;BR /&gt;..there's som much to learn..&lt;BR /&gt;&lt;BR /&gt;;)</description>
      <pubDate>Wed, 12 Sep 2001 12:54:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cheap-points-for-script-gurus-p/m-p/2577362#M920053</guid>
      <dc:creator>kent friberg</dc:creator>
      <dc:date>2001-09-12T12:54:29Z</dc:date>
    </item>
  </channel>
</rss>

