<?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: Help with script to edit a text file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950486#M927031</link>
    <description>Bob,&lt;BR /&gt;&lt;BR /&gt;You could try this -&lt;BR /&gt;&lt;BR /&gt;sed 'N;/^DISK/ s/^DISK.*\]//;s/\n//;N;s/\n//;' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;- ramd.&lt;/FILENAME&gt;</description>
    <pubDate>Mon, 14 Apr 2003 12:06:19 GMT</pubDate>
    <dc:creator>Ramkumar Devanathan</dc:creator>
    <dc:date>2003-04-14T12:06:19Z</dc:date>
    <item>
      <title>Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950484#M927029</link>
      <description>I have an application that generates a text file in a format similar to the following:&lt;BR /&gt;&lt;BR /&gt;DISK$MMCP1:[CXMMCP.V0200_123]FILE1.TLF -&lt;BR /&gt;/DIRECTORY_NAME=SYSWORK1 /FILE_NAME=FILE1 /CLASSIFICATION=U -&lt;BR /&gt;/READ /FILTYPE=1 /FILESIZE=1657 /RECTYPE=N /RECSIZE=512 /RECCOUNT=1657&lt;BR /&gt;DISK$MMCP3:[CXMMCP.V0100_123]FILE2.TLF -&lt;BR /&gt;/DIRECTORY_NAME=SYSWORK2 /FILE_NAME=FILE2 /CLASSIFICATION=U -&lt;BR /&gt;/READ /FILTYPE=1 /FILESIZE=1657 /RECTYPE=N /RECSIZE=512 /RECCOUNT=1657&lt;BR /&gt;DISK$MMCP1:[CXMMCP.ABRACADAB]FILE3.TLF -&lt;BR /&gt;/DIRECTORY_NAME=SYSWORK3 /FILE_NAME=FILE3 /CLASSIFICATION=U -&lt;BR /&gt;/READ /FILTYPE=3 /FILESIZE=29 /RECTYPE=N /RECSIZE=512 /RECCOUNT=29&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This file is used by another application and needs to be edited to make it look like this:&lt;BR /&gt;&lt;BR /&gt;FILE1.TLF /DIRECTORY_NAME=SYSWORK1 /FILE_NAME=FILE1 /CLASSIFICATION=U /READ /FILTYPE=1 /FILESIZE=1657 /RECTYPE=N /RECSIZE=512 /RECCOUNT=1657&lt;BR /&gt;FILE2.TLF /DIRECTORY_NAME=SYSWORK2 /FILE_NAME=FILE2 /CLASSIFICATION=U /READ /FILTYPE=1 /FILESIZE=1657 /RECTYPE=N /RECSIZE=512 /RECCOUNT=1657&lt;BR /&gt;FILE3.TLF /DIRECTORY_NAME=SYSWORK3 /FILE_NAME=FILE3 /CLASSIFICATION=U /READ /FILTYPE=3 /FILESIZE=29 /RECTYPE=N /RECSIZE=512 /RECCOUNT=29&lt;BR /&gt;&lt;BR /&gt;(In case the formatting is jumbled in the ITRC - the original file has three lines/record, each ending with a "-" and linefeed character. The desired file needs to have information deleted from the beginning of each record and should have one line/record with no "-".&lt;BR /&gt;&lt;BR /&gt;The file sometimes has upwards of 100 records. Manual editing with vi is tedious and I've tried to come up with a script to use sed, awk or perl to complete the editing but have had little success. I usually run headlong into a brick wall when replacing the linefeed characters at the end the first and second lines. &lt;BR /&gt;&lt;BR /&gt;Your assistance is greatly appreciated!&lt;BR /&gt;Have a grand day, Bob&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Apr 2003 10:48:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950484#M927029</guid>
      <dc:creator>Robert Krebs</dc:creator>
      <dc:date>2003-04-14T10:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950485#M927030</link>
      <description>This simple shell script will do what you want...&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read A B C D E&lt;BR /&gt;do&lt;BR /&gt; case ${A} in&lt;BR /&gt;  DISK*)        FNAM=${A#*\]}&lt;BR /&gt;                print -n "$FNAM" ;;&lt;BR /&gt;  /DIR*)        print -n "${A} ${B} ${C}" ;;&lt;BR /&gt;  /READ*)       print "${A} ${B} ${C} ${D} ${E}" ;;&lt;BR /&gt; esac&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Mon, 14 Apr 2003 11:03:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950485#M927030</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2003-04-14T11:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950486#M927031</link>
      <description>Bob,&lt;BR /&gt;&lt;BR /&gt;You could try this -&lt;BR /&gt;&lt;BR /&gt;sed 'N;/^DISK/ s/^DISK.*\]//;s/\n//;N;s/\n//;' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;- ramd.&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 14 Apr 2003 12:06:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950486#M927031</guid>
      <dc:creator>Ramkumar Devanathan</dc:creator>
      <dc:date>2003-04-14T12:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950487#M927032</link>
      <description>Here's the correction with command to remove the minus signs -&lt;BR /&gt;&lt;BR /&gt;sed 'N;/^DISK/ s/^DISK.*\]//;s/\n//;N;s/\n//;' &lt;FILENAME&gt; | sed 's/-//g'&lt;BR /&gt;&lt;BR /&gt;HTH.&lt;BR /&gt;&lt;BR /&gt;- ramd.&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 14 Apr 2003 12:11:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950487#M927032</guid>
      <dc:creator>Ramkumar Devanathan</dc:creator>
      <dc:date>2003-04-14T12:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950488#M927033</link>
      <description>Hi,&lt;BR /&gt;please try the attached script, using your infile as par 1.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Mon, 14 Apr 2003 12:53:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950488#M927033</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-04-14T12:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950489#M927034</link>
      <description>I think this perl script can do it-&lt;BR /&gt;&lt;BR /&gt;perl -n -e 's/^DISK[^\]]*\]//;if (s/ -$//) { print $_ ; } else { print $_,"\n"; }' infile &amp;gt;outfile&lt;BR /&gt;&lt;BR /&gt;Where infile contains the text and outfile will be the result.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 14 Apr 2003 14:15:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950489#M927034</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-04-14T14:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950490#M927035</link>
      <description>Outstanding!&lt;BR /&gt;Thank you all for your helpful answers. I used yours first, Ramkumar, because it was the shortest and it worked like a champ! The others looked great as well. After several days of pounding my head against the wall for this one I finally have an answer. As a good friend says "There's a lot of pleasure to be gained by stopping beating one's head against the wall". Again, thank you for your help, it's why we come here.&lt;BR /&gt;Have a grand day, Bob</description>
      <pubDate>Tue, 15 Apr 2003 08:41:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950490#M927035</guid>
      <dc:creator>Robert Krebs</dc:creator>
      <dc:date>2003-04-15T08:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950491#M927036</link>
      <description>I couldn't help but add another one. Coding sed is just like that...&lt;BR /&gt;&lt;BR /&gt;sed '/-[ ]*$/N;N;s/-[ ]*\n//g' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;It seems to work fine and gets rid of the "-  " as well.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Seth&lt;/FILENAME&gt;</description>
      <pubDate>Tue, 15 Apr 2003 14:29:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950491#M927036</guid>
      <dc:creator>Seth Parker</dc:creator>
      <dc:date>2003-04-15T14:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script to edit a text file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950492#M927037</link>
      <description>Bob,&lt;BR /&gt;&lt;BR /&gt;A correction.  I had copied the input from the ITRC and noticed that your spec said "-" then linefeed.  What I posted handles any trailing spaces that might be there.&lt;BR /&gt;&lt;BR /&gt;If there aren't any trailing spaces, then use this:&lt;BR /&gt;&lt;BR /&gt;sed '/-$/N;N;s/-\n//g' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;It's even shorter!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Seth&lt;/FILENAME&gt;</description>
      <pubDate>Tue, 15 Apr 2003 14:35:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script-to-edit-a-text-file/m-p/2950492#M927037</guid>
      <dc:creator>Seth Parker</dc:creator>
      <dc:date>2003-04-15T14:35:10Z</dc:date>
    </item>
  </channel>
</rss>

