<?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: paste two files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495585#M830281</link>
    <description>Thanks for everyones help.&lt;BR /&gt;</description>
    <pubDate>Tue, 20 Feb 2001 15:28:36 GMT</pubDate>
    <dc:creator>Nik</dc:creator>
    <dc:date>2001-02-20T15:28:36Z</dc:date>
    <item>
      <title>paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495565#M830261</link>
      <description>Hi,&lt;BR /&gt;Thanks to these forums I have found that I can merge two 1 column files into one 2 column file but using the 'paste' command..&lt;BR /&gt;My question is, is there anyway of matching the lines up?&lt;BR /&gt;&lt;BR /&gt;so for instance, if I have two columns:&lt;BR /&gt;&lt;BR /&gt;line1   line1&lt;BR /&gt;line2   line2&lt;BR /&gt;line3   line4&lt;BR /&gt;line4   line5&lt;BR /&gt;line5&lt;BR /&gt;&lt;BR /&gt;Is there anyway I can get it to paste them together as:&lt;BR /&gt;&lt;BR /&gt;line1  line1&lt;BR /&gt;line2  line2&lt;BR /&gt;line3&lt;BR /&gt;line4  line4&lt;BR /&gt;line5  line5&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Feb 2001 11:27:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495565#M830261</guid>
      <dc:creator>Nik</dc:creator>
      <dc:date>2001-02-19T11:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495566#M830262</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;What criterion would you use to decide whether or not a line in file1 matche a line in file2??&lt;BR /&gt;&lt;BR /&gt;Bye,&lt;BR /&gt;Rik.&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Feb 2001 11:34:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495566#M830262</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2001-02-19T11:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495567#M830263</link>
      <description>Hi Nik,&lt;BR /&gt;&lt;BR /&gt;If your two files have a common field, then you could ude the 'join' command.&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Feb 2001 11:35:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495567#M830263</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-02-19T11:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495568#M830264</link>
      <description>Hi,&lt;BR /&gt;It must be identical...&lt;BR /&gt;say it's a list of hostname on systems... I want to ensure no hosts are missing from one and not in the other.. unfortunatly no file is the master.. some hosts are in one, and not in another and vice versa..&lt;BR /&gt;&lt;BR /&gt;thanks.</description>
      <pubDate>Mon, 19 Feb 2001 11:37:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495568#M830264</guid>
      <dc:creator>Nik</dc:creator>
      <dc:date>2001-02-19T11:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495569#M830265</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;In that case, I woulkd use the comm command to identify the differences between two (sorted) files.&lt;BR /&gt;&lt;BR /&gt;Bye,&lt;BR /&gt;Rik</description>
      <pubDate>Mon, 19 Feb 2001 11:38:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495569#M830265</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2001-02-19T11:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495570#M830266</link>
      <description>Hi Nik,&lt;BR /&gt;&lt;BR /&gt;If you want to keep just one instance of every line, you could use:&lt;BR /&gt;cat file1 file2 | sort -u &amp;gt; file3&lt;BR /&gt;This would create a file, superset of file1 and file2 without duplicate entries.&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Feb 2001 11:48:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495570#M830266</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-02-19T11:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495571#M830267</link>
      <description>Rik,&lt;BR /&gt;thanks, 'comm' is good, but I would really like to just match the lines and output to a new file with 2 columns.&lt;BR /&gt;So for instance...&lt;BR /&gt;If there's a host called "machine1" in file 1, but not in file 2, just print it on one line, however if there is a host called "machine2" in file1 AND file2 then print them next to each other..&lt;BR /&gt;basically I've sorted both lists in telephone directory order using 'sort -d' and would now just like to align matching entries against each other...&lt;BR /&gt;&lt;BR /&gt;hmm... maybe it's not possible without a big script!&lt;BR /&gt;&lt;BR /&gt;thanks anyway.. points on way!</description>
      <pubDate>Mon, 19 Feb 2001 11:59:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495571#M830267</guid>
      <dc:creator>Nik</dc:creator>
      <dc:date>2001-02-19T11:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495572#M830268</link>
      <description>I think the best way to do this would be with a small script of 10 - 20 lines.&lt;BR /&gt;&lt;BR /&gt;If you would like some help let me know and I will help or even write it for you. (I don't have a lot to do right now).</description>
      <pubDate>Mon, 19 Feb 2001 12:18:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495572#M830268</guid>
      <dc:creator>Glen Olsen</dc:creator>
      <dc:date>2001-02-19T12:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495573#M830269</link>
      <description>that'd be great...&lt;BR /&gt;If you could put together a little script..&lt;BR /&gt;I'd be interested to see how it's done.&lt;BR /&gt;&lt;BR /&gt;Nik&lt;BR /&gt;[why argue with someone who offering to write a script for you?] :)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Feb 2001 12:24:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495573#M830269</guid>
      <dc:creator>Nik</dc:creator>
      <dc:date>2001-02-19T12:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495574#M830270</link>
      <description>Nik,&lt;BR /&gt;&lt;BR /&gt;Here (attached to ths post - click on the papar-clip) is a little script that does what you asked. Mind though, it does not do anything when a line in in file2 and not in file1 (but you didn't ask it, did you?)&lt;BR /&gt;&lt;BR /&gt;Bye,&lt;BR /&gt;Rik</description>
      <pubDate>Mon, 19 Feb 2001 12:47:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495574#M830270</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2001-02-19T12:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495575#M830271</link>
      <description>Nik,&lt;BR /&gt;&lt;BR /&gt;This time the attachment is included!!!&lt;BR /&gt;&lt;BR /&gt;Here (attached to ths post - click on the papar-clip) is a little script that does what you asked. Mind though, it does not do anything when a line in in file2 and not in file1 (but you didn't ask it, did you?)&lt;BR /&gt;&lt;BR /&gt;Bye,&lt;BR /&gt;Rik</description>
      <pubDate>Mon, 19 Feb 2001 12:48:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495575#M830271</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2001-02-19T12:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495576#M830272</link>
      <description>OK a couple of questions first&lt;BR /&gt;&lt;BR /&gt;Do you need a file to be produced as you have indercated above&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;would yout like to scripts to say that "hosname is in file1 but not 2" etc &lt;BR /&gt;&lt;BR /&gt;or &lt;BR /&gt;&lt;BR /&gt;if the hostname is not in file2 but is in file 1 the add it to file 2&lt;BR /&gt;&lt;BR /&gt;the choice is yours :-)</description>
      <pubDate>Mon, 19 Feb 2001 12:50:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495576#M830272</guid>
      <dc:creator>Glen Olsen</dc:creator>
      <dc:date>2001-02-19T12:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495577#M830273</link>
      <description>Hi Glen,&lt;BR /&gt;If I could just get a file created with the two columns...&lt;BR /&gt;if it's only in file1, create the entry on one line on the left, if it's only in file2 then create the entry on one line on the right..&lt;BR /&gt;if it's in both, create both entrys left and right..&lt;BR /&gt;&lt;BR /&gt;machine1&lt;BR /&gt;          machine2&lt;BR /&gt;machine3  machine3&lt;BR /&gt;machine4&lt;BR /&gt;          machine5&lt;BR /&gt;&lt;BR /&gt;hope this makes sense!&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;Nik&lt;BR /&gt;&lt;BR /&gt;Rik: I'm trying your script now.. I might be able to adjust it to get results mentioned above? thanks.</description>
      <pubDate>Mon, 19 Feb 2001 13:07:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495577#M830273</guid>
      <dc:creator>Nik</dc:creator>
      <dc:date>2001-02-19T13:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495578#M830274</link>
      <description>Nik,&lt;BR /&gt;&lt;BR /&gt;Here is another one that does it all. It uses arrays, but this is no problem in the sh-posix shell (/usr/bin/sh).&lt;BR /&gt;&lt;BR /&gt;Bye,&lt;BR /&gt;Rik</description>
      <pubDate>Mon, 19 Feb 2001 13:30:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495578#M830274</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2001-02-19T13:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495579#M830275</link>
      <description>Rik,&lt;BR /&gt;That's brilliant! But it won't stop!&lt;BR /&gt;Tried (( iContinue == FALSE )) instead of single =   but no luck...&lt;BR /&gt;&lt;BR /&gt;Nik</description>
      <pubDate>Mon, 19 Feb 2001 13:50:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495579#M830275</guid>
      <dc:creator>Nik</dc:creator>
      <dc:date>2001-02-19T13:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495580#M830276</link>
      <description>Nik,&lt;BR /&gt;&lt;BR /&gt;You're right.&lt;BR /&gt;&lt;BR /&gt;It doesn't stop (except when to files have equal number of lines -- incidentally the way I tested it). Let me have a look, and I'll post a correction if OK.&lt;BR /&gt;&lt;BR /&gt;Bye,&lt;BR /&gt;Rik.</description>
      <pubDate>Mon, 19 Feb 2001 13:58:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495580#M830276</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2001-02-19T13:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495581#M830277</link>
      <description>Nik,&lt;BR /&gt;&lt;BR /&gt;BTW, thanks for making me a Wizard!!&lt;BR /&gt;&lt;BR /&gt;Bye.</description>
      <pubDate>Mon, 19 Feb 2001 13:59:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495581#M830277</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2001-02-19T13:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495582#M830278</link>
      <description>HI&lt;BR /&gt;&lt;BR /&gt;Try this one as well&lt;BR /&gt;&lt;BR /&gt;It a bit bigger than it 10 - 20 lines but it does it in a way that the files stay sorted</description>
      <pubDate>Mon, 19 Feb 2001 14:00:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495582#M830278</guid>
      <dc:creator>Glen Olsen</dc:creator>
      <dc:date>2001-02-19T14:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495583#M830279</link>
      <description>Nik,&lt;BR /&gt;&lt;BR /&gt;It does finish now!! Even when different number of lines in the files. And it still works with equal number of lines in the input files.&lt;BR /&gt;&lt;BR /&gt;Bye,&lt;BR /&gt;Rik</description>
      <pubDate>Mon, 19 Feb 2001 14:06:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495583#M830279</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2001-02-19T14:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: paste two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495584#M830280</link>
      <description>Hi Nik,&lt;BR /&gt;&lt;BR /&gt;Combining 'comm' and 'sed' will do the job.&lt;BR /&gt;&lt;BR /&gt;comm file1 file2 | sed 's/\(&lt;TAB&gt;&lt;TAB&gt;\)\(.*$\)/\2&lt;TAB&gt;\2/'&lt;BR /&gt;&lt;BR /&gt;Replace the '&lt;TAB&gt;' by a real tab character in your script.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;/TAB&gt;&lt;/TAB&gt;&lt;/TAB&gt;&lt;/TAB&gt;</description>
      <pubDate>Mon, 19 Feb 2001 14:09:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/paste-two-files/m-p/2495584#M830280</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-02-19T14:09:02Z</dc:date>
    </item>
  </channel>
</rss>

