All,

On Tue, 28 Mar 2000, Dow Hurst wrote:

> What would be a way, using shell scripting, to take one line from two

> separate text files, append them into one line, and output that

> resulting line to another file?  In the following script, I started to

> "cat" them together, then "sort" them using the line number from the

> "grep" command, however, I thought that it would be easier to read if

> I could join the two pieces of data into one line.  I just don't know

> how to do that.  I don't know any programming languages yet and have

> only delved into shell scripts at this point.  Thanks for your help,

        I'm not sure if you only want the matching lines, or if you

want all lines, but "paste" may do the trick.  See "man paste" for

details, but for each file listed, it "pastes" lines side-by-side from

each file, with the "glue" character being a tab.  That's settable, of

course.  Then you could grep for "file_1_pattern.*file_2_pattern" if

you wish.

        If you have sorted files with "keys" (a string of non-blank 

chars), "join" will do the trick also, if you have a need for a more 

relational type application.  See "man join" for details.

Danny


--
To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.