HP3000-L Archives

October 2003, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
David Powell <[log in to unmask]>
Reply To:
Date:
Tue, 14 Oct 2003 18:35:30 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (80 lines)
If for any reason the suggestion about 'paste' doesn't work, I think it can
be done with pure old-fashioned MPE commands.....  (totally untested)

First, shovel the contents of the 2 original files into 2 msg files (can be
done with a file equation, and the :print command with 'page=0'.  This is so
the following input commands won't keep reading the 1st record over & over.
Perhaps start with...
:purge msgfile1, temp
:file msgfile1; rec=<whatever>;msg;disc=<whatever>
:print file1.pub; page=0  >> *msgfile1
This should create a new temp msg file with the same old data.
(repeat for file 2)


Then set up a while loop until finfo says the eof of one or both message
files is zero.
Perhaps by...
:while fifo('msgfile1','eof') > 0 and finfo('msgfile2','eof') > 0
... depending on what you want if the two files aren't guaranteed to have
the same number of records.


Within the while loop, something like:
:input f_1  < msgfile1
:input f_2 < msgfile2
(maybe use str, ltrim, rtrim, lft or rht functions to trim blanks, etc,)
:echo !f_1 whateverothercharactersyouwant !f_2 >> newfile

And finally
:save newfile

etc.

I'm not sure if you really wanted the '|' character in your output file.  At
least with this approach you have insert thinks like that if you want, or
chop fields that are too long, if you need to.  Does 'paste' let you do
that?

Dave ('massively ignorant about the shell, but unwilling to call pure MPE
the "wrong" tool for anything') Powell

----- Original Message -----
From: "Srifan_In" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Tuesday, October 14, 2003 16:46
Subject: [HP3000-L] merging two files.


> I am struggling to write a job which can merge two files.
>
> The functionality I am looking for is like below:
>
> contents of File1.pub
>
> aaa
> bbb
> ccc
>
> contents of File2. pub
>
> 123
> 456
> 789
>
> I want to write a job, which has to merge the files and create a new
> file called file3.pub like belo
>
> aaa|123
> bbb|456
> ccc|789
>
> Any pointers will be of great help.
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2