<?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: Seperating data from a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325296#M670945</link>
    <description>&amp;gt;what-ever means?  I have to specify anything, could you please example&lt;BR /&gt;&lt;BR /&gt;You need to mention how you get those 100 files.  If you do them one by one, then you can remove that for loop and just use $2.tmp.&lt;BR /&gt;&lt;BR /&gt;If you are going to do them all at once, you will need to get a list of those files.  Either from ls(1) or from a file.  You need to be more specific where that mail command goes after you create the file(s).</description>
    <pubDate>Fri, 19 Dec 2008 13:47:11 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-12-19T13:47:11Z</dc:date>
    <item>
      <title>Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325284#M670933</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;I attaching a file, &lt;BR /&gt;in that file every record starts with PURCHASE ORDER NUMBER, &lt;BR /&gt;so I want to seperate the every record starts with PURCHASE ORDER NUMBER and create a new file for every one records, &lt;BR /&gt;&lt;BR /&gt;how can I used grep command &lt;BR /&gt;&lt;BR /&gt;please advise me&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2008 18:53:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325284#M670933</guid>
      <dc:creator>pk1974</dc:creator>
      <dc:date>2008-12-17T18:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325285#M670934</link>
      <description>I'm sorry but that doesn't make any sense at all.  On the one hand you say that "every record starts with PURCHASE ORDER NUMBER" but then you say you want to separate "the every record starts with PURCHASE ORDER NUMBER".  If they all start with PURCHASE ORDER NUMBER, what's left to separate?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 17 Dec 2008 18:59:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325285#M670934</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2008-12-17T18:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325286#M670935</link>
      <description>Wow,&lt;BR /&gt;&lt;BR /&gt;i bet Verizon won't be too pleased to see this kind of info posted on a public forum.</description>
      <pubDate>Wed, 17 Dec 2008 19:14:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325286#M670935</guid>
      <dc:creator>Autocross.US</dc:creator>
      <dc:date>2008-12-17T19:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325287#M670936</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;Please find the attachment&lt;BR /&gt;&lt;BR /&gt;I want to generate new files for every record in the attached file&lt;BR /&gt;&lt;BR /&gt;In the attached file&lt;BR /&gt;&lt;BR /&gt;for example in the attached file&lt;BR /&gt;&lt;BR /&gt;one record is in italic and bold&lt;BR /&gt;&lt;BR /&gt;and other record is plane&lt;BR /&gt;&lt;BR /&gt;I want to create 2 files, one file for Italic and bold record and second file for the plane text record</description>
      <pubDate>Wed, 17 Dec 2008 19:21:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325287#M670936</guid>
      <dc:creator>PK_1975</dc:creator>
      <dc:date>2008-12-17T19:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325288#M670937</link>
      <description>You can not use a grep command to do this.&lt;BR /&gt;But AWK ro PERL woudl be happy to.&lt;BR /&gt;For example, if you want to create files called S0155807.tmp where S0155807 is the &lt;BR /&gt;PURCHASE_ORDER_NO then you coudl simply use:&lt;BR /&gt;&lt;BR /&gt;awk '/^PURCHASE_ORDER_NO:/{file=$2 ".tmp"} file { print &amp;gt;&amp;gt; file}' your-file&lt;BR /&gt;&lt;BR /&gt;So there are 2 lines in this 'script':&lt;BR /&gt;&lt;BR /&gt;/^PURCHASE_ORDER_NO:/{file=$2 ".tmp"} &lt;BR /&gt;That says, IF you see a line STARTING with PU... THEN set variable 'file' to the concatenation of field 2 on the line with the string ".tmp"&lt;BR /&gt;&lt;BR /&gt;Next line:&lt;BR /&gt;&lt;BR /&gt;file { print &amp;gt;&amp;gt; file}&lt;BR /&gt;&lt;BR /&gt;That says... IF variable 'file' is set THEN APPEND the input line ($0) to the fiel with the name in variable 'file'.&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;&lt;BR /&gt;and... uh... let's just pretend those were mock-up names and phone numbers you posted there in a public forum huh?  This time.&lt;BR /&gt;And there won't be a next time right?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2008 20:26:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325288#M670937</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-12-17T20:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325289#M670938</link>
      <description>So... did the awk solution work for you? Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Dec 2008 14:56:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325289#M670938</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-12-18T14:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325290#M670939</link>
      <description>HI &lt;BR /&gt;&lt;BR /&gt;awk command is working fine when I use from command line, &lt;BR /&gt;&lt;BR /&gt;when I use the command in the script and specifying the file path it is not working&lt;BR /&gt;&lt;BR /&gt;eg&lt;BR /&gt;&lt;BR /&gt; awk '/^PURCHASE_ORDER_NO:/{file=$2 ".tmp"} file { print &amp;gt;&amp;gt; file}' /home/abc/abc.txt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;could you please advise me who to specify the file path</description>
      <pubDate>Thu, 18 Dec 2008 15:34:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325290#M670939</guid>
      <dc:creator>PK_1975</dc:creator>
      <dc:date>2008-12-18T15:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325291#M670940</link>
      <description>&lt;!--!*#--&gt;I think I understands what he wants to do.&lt;BR /&gt;&lt;BR /&gt;He wants to seperate 1 complete record to a file and so on. So that each new file contains all the information of that purchase record.&lt;BR /&gt;&lt;BR /&gt;Something like this might do the trick :P but as I don't have access to a shell atm this isn't tested.&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;# Set arguments to variables&lt;BR /&gt;# Which file to parse from&lt;BR /&gt;input_file=$1&lt;BR /&gt;# The standard which output files will be named in, ex. order-S0155806&lt;BR /&gt;namestd=$2&lt;BR /&gt;&lt;BR /&gt;# Change IFS to handle newlines instead of space&lt;BR /&gt;IFS="\n"&lt;BR /&gt;for i in $(cat $input_file); do&lt;BR /&gt;   # Just to check if we are going to start a new file or not&lt;BR /&gt;   echo $i | grep "PURCHASE_ORDER_NO:" &amp;amp;&amp;gt; /dev/null&lt;BR /&gt;   if [ $? -eq 0 ]; then&lt;BR /&gt;      # Get the order id number to seperate the files from each other&lt;BR /&gt;      orderid=$(echo $i | sed -e "s/^PURCHASE_ORDER_NO: *\([A-Za-z0-9]\) *$/\1/")&lt;BR /&gt;      # Create the new filename&lt;BR /&gt;      output_file="$namestd-$orderid"&lt;BR /&gt;   fi&lt;BR /&gt;   # Write the output to the file.&lt;BR /&gt;   echo $i &amp;gt;&amp;gt; $output_file&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;(And yes, it's a slow day and I'm bored :P)&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;Fredrik Eriksson</description>
      <pubDate>Thu, 18 Dec 2008 15:41:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325291#M670940</guid>
      <dc:creator>Fredrik.eriksson</dc:creator>
      <dc:date>2008-12-18T15:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325292#M670941</link>
      <description>&amp;gt;&amp;gt;  it is not working&lt;BR /&gt;&lt;BR /&gt;Hmmm... &lt;BR /&gt;Errors?&lt;BR /&gt;'Nothing happens'?&lt;BR /&gt;Files create in places you did not expect?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; awk '/^PURCHASE_ORDER_NO:/{file=$2 ".tmp"} file { print &amp;gt;&amp;gt; file}' /home/abc/abc.txt&lt;BR /&gt;&lt;BR /&gt;Apparently you needed to epxlicitly specify the input.&lt;BR /&gt;You may need to expllicitly specify the output.&lt;BR /&gt;&lt;BR /&gt;To do this you may want to change:&lt;BR /&gt;&lt;BR /&gt;file=$2 ".tmp"&lt;BR /&gt;&lt;BR /&gt;to &lt;BR /&gt;&lt;BR /&gt;file= "/home/abc/" $2 ".tmp"&lt;BR /&gt;&lt;BR /&gt;Good luck,&lt;BR /&gt;Hein.</description>
      <pubDate>Thu, 18 Dec 2008 17:09:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325292#M670941</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-12-18T17:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325293#M670942</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;As per ur suggestion I used the command in the script, the multiple files creating,&lt;BR /&gt;I want to pick each file and send email, one email for one file, if it creates 100 files, it should send 100 emails&lt;BR /&gt;could you please tell me how to process&lt;BR /&gt;&lt;BR /&gt;Here I am using pick one file and send email,&lt;BR /&gt;how can I handle multiple files to send email, with file  name starts with $2".tmp"&lt;BR /&gt;if test -s "${input_file:?}"&lt;BR /&gt;  then&lt;BR /&gt;      elm -s "${email_subject:?}" \&lt;BR /&gt;              "${email_recipients[@]:?}" &amp;lt; "${input_file:?}" &lt;BR /&gt;&lt;BR /&gt; Thanks&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Dec 2008 22:00:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325293#M670942</guid>
      <dc:creator>PK_1975</dc:creator>
      <dc:date>2008-12-18T22:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325294#M670943</link>
      <description>&lt;!--!*#--&gt;&amp;gt;one email for one file, if it creates 100 files, it should send 100 emails.  could you please tell me how to process?&lt;BR /&gt;&lt;BR /&gt;for file in what-ever; do&lt;BR /&gt;   mailx -s "${email_subject:?}"  "${email_recipients[@]:?}" &amp;lt; $file&lt;BR /&gt;done</description>
      <pubDate>Fri, 19 Dec 2008 05:17:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325294#M670943</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-12-19T05:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325295#M670944</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;u specified as &lt;BR /&gt;&lt;BR /&gt;"for file in what-ever; do"&lt;BR /&gt;&lt;BR /&gt;what-ever means? &lt;BR /&gt;I have to specify anything, could you please example&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Dec 2008 12:48:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325295#M670944</guid>
      <dc:creator>PK_1975</dc:creator>
      <dc:date>2008-12-19T12:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325296#M670945</link>
      <description>&amp;gt;what-ever means?  I have to specify anything, could you please example&lt;BR /&gt;&lt;BR /&gt;You need to mention how you get those 100 files.  If you do them one by one, then you can remove that for loop and just use $2.tmp.&lt;BR /&gt;&lt;BR /&gt;If you are going to do them all at once, you will need to get a list of those files.  Either from ls(1) or from a file.  You need to be more specific where that mail command goes after you create the file(s).</description>
      <pubDate>Fri, 19 Dec 2008 13:47:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325296#M670945</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-12-19T13:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325297#M670946</link>
      <description>Who is the email receipient for each PO file? Is it the person in the "Order Contact: " line or the person in the last "NOTES" line as in "NOTES:   XXX FIRST LAST 856-xxx-yyyy"?&lt;BR /&gt;In that case you need to read each PO file and extract the name and then convert that to an email address based on whatever format you use.</description>
      <pubDate>Fri, 19 Dec 2008 14:01:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325297#M670946</guid>
      <dc:creator>TTr</dc:creator>
      <dc:date>2008-12-19T14:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325298#M670947</link>
      <description>&lt;!--!*#--&gt;I guess we should have asked the old but valueable:&lt;BR /&gt;  'WHAT PROBLEM ARE YOU REALLY TRYING TO SOLVE'.&lt;BR /&gt;&lt;BR /&gt;WHY stick each order in a unique file, only to Email thme out? a SHELL or PERL script could just keep all data in memory and call mail directly from a sub-process feeding it the lines without ever needing a temp file to hold an order.&lt;BR /&gt;&lt;BR /&gt;The AWK script could easily detect the new order condition END as well as the already present  /^PURCHASE_ORDER_NO/ test, and then just do the Email of the past order right there and then, re-suing the same file (name) for the next order, renaming failed sends to a file to remain on the box with the order number in the file. Or in sticking with the unique names, perhaps delete succesfully send temp files.&lt;BR /&gt;&lt;BR /&gt;HOW will you determine the "to:" Email address? Can that be integrated in the scripts? Perhaps a helper file with (phone) number to Email mapping?&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Dec 2008 14:13:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325298#M670947</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-12-19T14:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325299#M670948</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;Now I am able to send individual email for every individual file by the using the below code&lt;BR /&gt;&lt;BR /&gt;for file in  `ls /home/abc/*.tmp`&lt;BR /&gt;do&lt;BR /&gt; if test -s "${file:?}"&lt;BR /&gt; then&lt;BR /&gt; elm -s "${email_subject:?}" "${email_recipients[@]:?}" &amp;lt; $file&lt;BR /&gt;        fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Now I want to use only file name from  the /home/abc directory and place that filename in the email subject for every email&lt;BR /&gt;&lt;BR /&gt;the email subject should be like this "welcome abc.txt" &lt;BR /&gt;&lt;BR /&gt;how can I place name of the file in the code could you please help me &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Dec 2008 23:32:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325299#M670948</guid>
      <dc:creator>PK_1975</dc:creator>
      <dc:date>2008-12-19T23:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating data from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325300#M670949</link>
      <description>Before the elm line in your script, calculate the filename by using the basename command&lt;BR /&gt;filename=`basename $file`&lt;BR /&gt;elm -s "$filename" "${email_recipients[@]:?}" &amp;lt; $file&lt;BR /&gt;You can append or prepend any other text in the filename variable</description>
      <pubDate>Sat, 20 Dec 2008 00:29:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/seperating-data-from-a-file/m-p/4325300#M670949</guid>
      <dc:creator>TTr</dc:creator>
      <dc:date>2008-12-20T00:29:18Z</dc:date>
    </item>
  </channel>
</rss>

