<?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: How i can merge two text files? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001559#M98248</link>
    <description>Hi,&lt;BR /&gt;thanks for script, but it's too hard for me.(i donÂ´t know use of perl) i will try to use it.&lt;BR /&gt;A traditionally unix script would be more easy for me.&lt;BR /&gt;&lt;BR /&gt;thanks.&lt;BR /&gt;Best regards.&lt;BR /&gt;Francesco</description>
    <pubDate>Wed, 06 Sep 2006 17:44:17 GMT</pubDate>
    <dc:creator>Francesco_13</dc:creator>
    <dc:date>2006-09-06T17:44:17Z</dc:date>
    <item>
      <title>How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001551#M98240</link>
      <description>Hi,&lt;BR /&gt;i have two text files with table names,for example:&lt;BR /&gt;&lt;BR /&gt;file1     file2&lt;BR /&gt;--------|-------------&lt;BR /&gt;tab1      tab6&lt;BR /&gt;tab2      tab2&lt;BR /&gt;tab3      tab5&lt;BR /&gt;tab4      tab7&lt;BR /&gt;tab5    | tab4&lt;BR /&gt;&lt;BR /&gt;How i can merge file1 and file2 and produce file3 with all table names , with NO duplicate table names?&lt;BR /&gt;thanks&lt;BR /&gt;Best regards.&lt;BR /&gt;Francesco&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2006 16:08:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001551#M98240</guid>
      <dc:creator>Francesco_13</dc:creator>
      <dc:date>2006-09-06T16:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001552#M98241</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# cat file1 file2 | sort -u &amp;gt; file3&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 06 Sep 2006 16:27:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001552#M98241</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-06T16:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001553#M98242</link>
      <description>sort -u file1 file2 &amp;gt; mymergedfile&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2006 16:31:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001553#M98242</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-09-06T16:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001554#M98243</link>
      <description>i'm sorry , i forget the last action:&lt;BR /&gt;for the same table name in file1 and file2, i'm do it to write the table name from file2 only.(the duplicate table_name to eliminate it's the table_name from file1).&lt;BR /&gt;&lt;BR /&gt;more thanks and regards&lt;BR /&gt;&lt;BR /&gt;Francesco</description>
      <pubDate>Wed, 06 Sep 2006 16:33:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001554#M98243</guid>
      <dc:creator>Francesco_13</dc:creator>
      <dc:date>2006-09-06T16:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001555#M98244</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;You wrote, "for the same table name in file1 and file2, i'm do it to write the table name from file2 only.(the duplicate table_name to eliminate it's the table_name from file1).".&lt;BR /&gt;&lt;BR /&gt;I'm missing something.  What does it matter if they are the same?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 06 Sep 2006 16:43:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001555#M98244</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-06T16:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001556#M98245</link>
      <description>Hi,&lt;BR /&gt;the file1 and file2 have the same table names, but file1 it's from one old version and file2 from new version of the same table. I need to produce the file3 with all table_names and know if the occurence it's from old or new version of same table.&lt;BR /&gt;(the same table have different data depending of version and i need to resume if the table have old or new data&lt;BR /&gt;example:&lt;BR /&gt;file3&lt;BR /&gt;tab1 &amp;gt; file1&lt;BR /&gt;tab2 &amp;gt; file1&lt;BR /&gt;tab3 &amp;gt; file1&lt;BR /&gt;tab4 &amp;gt; file2&lt;BR /&gt;tab5 &amp;gt; file2&lt;BR /&gt;tab6 &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;i hope it's clear explained for my poor english, and sorry if i have changed the original question!&lt;BR /&gt;+ thanks and regards&lt;BR /&gt;&lt;BR /&gt;Francesco&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2006 17:03:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001556#M98245</guid>
      <dc:creator>Francesco_13</dc:creator>
      <dc:date>2006-09-06T17:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001557#M98246</link>
      <description>You'll need a little script.&lt;BR /&gt;Here is a perl suggestion and sample usage&lt;BR /&gt;&lt;BR /&gt;$ cat x.pl&lt;BR /&gt;while ($file=shift @ARGV) {&lt;BR /&gt; open FILE, "&amp;lt;$file";&lt;BR /&gt; while (&lt;FILE&gt;) {&lt;BR /&gt;  chomp;&lt;BR /&gt;  $tables{$_} = $file;&lt;BR /&gt;  }&lt;BR /&gt; }&lt;BR /&gt;foreach (sort keys %tables) {&lt;BR /&gt;  print "$_ &amp;gt; $tables{$_}\n";&lt;BR /&gt;}$ cat x&lt;BR /&gt;aap&lt;BR /&gt;noot&lt;BR /&gt;mies&lt;BR /&gt;$ cat xx&lt;BR /&gt;noot&lt;BR /&gt;mies&lt;BR /&gt;teun&lt;BR /&gt;piet&lt;BR /&gt;$ cat xxx&lt;BR /&gt;teun&lt;BR /&gt;vuur$ perl x.pl x xx xxx&lt;BR /&gt;aap  &amp;gt; x&lt;BR /&gt;mies &amp;gt; xx&lt;BR /&gt;noot &amp;gt; xx&lt;BR /&gt;piet &amp;gt; xx&lt;BR /&gt;teun &amp;gt; xxx&lt;BR /&gt;vuur &amp;gt; xxx&lt;BR /&gt;$ perl x.pl  xxx x xx&lt;BR /&gt;aap  &amp;gt; x&lt;BR /&gt;mies &amp;gt; xx&lt;BR /&gt;noot &amp;gt; xx&lt;BR /&gt;piet &amp;gt; xx&lt;BR /&gt;teun &amp;gt; xx&lt;BR /&gt;vuur &amp;gt; xxx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;</description>
      <pubDate>Wed, 06 Sep 2006 17:13:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001557#M98246</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-09-06T17:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001558#M98247</link>
      <description>Hi Francesco,&lt;BR /&gt;&lt;BR /&gt;I tested this under FreeBSD, as I don't have access to HP-UX at the moment.  HP-UX solution should be similar.&lt;BR /&gt;&lt;BR /&gt;$ cat f1 &amp;amp;&amp;amp; echo '====' &amp;amp;&amp;amp; cat f2    &lt;BR /&gt;tab1&lt;BR /&gt;tab1&lt;BR /&gt;tab2&lt;BR /&gt;tab3&lt;BR /&gt;tab4&lt;BR /&gt;====&lt;BR /&gt;tab2&lt;BR /&gt;tab4&lt;BR /&gt;tab6&lt;BR /&gt;tab7&lt;BR /&gt;$ grep -H '' * | sort -t: +1 | uniq&lt;BR /&gt;f1:tab1&lt;BR /&gt;f1:tab2&lt;BR /&gt;f2:tab2&lt;BR /&gt;f1:tab3&lt;BR /&gt;f1:tab4&lt;BR /&gt;f2:tab4&lt;BR /&gt;f2:tab6&lt;BR /&gt;f2:tab7&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Wed, 06 Sep 2006 17:41:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001558#M98247</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-09-06T17:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001559#M98248</link>
      <description>Hi,&lt;BR /&gt;thanks for script, but it's too hard for me.(i donÂ´t know use of perl) i will try to use it.&lt;BR /&gt;A traditionally unix script would be more easy for me.&lt;BR /&gt;&lt;BR /&gt;thanks.&lt;BR /&gt;Best regards.&lt;BR /&gt;Francesco</description>
      <pubDate>Wed, 06 Sep 2006 17:44:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001559#M98248</guid>
      <dc:creator>Francesco_13</dc:creator>
      <dc:date>2006-09-06T17:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001560#M98249</link>
      <description>&lt;!--!*#--&gt;From Hein's example you can use awk:&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;TMP=/var/tmp/merge.$$&lt;BR /&gt;for i in $* ; do&lt;BR /&gt;   awk -v NAME=$i '&lt;BR /&gt;{ print $0, "&amp;gt;", NAME&lt;BR /&gt;} ' $i &amp;gt;&amp;gt; $TMP&lt;BR /&gt;done&lt;BR /&gt;sort -u -k1,1 $TMP&lt;BR /&gt;rm -f $TMP&lt;BR /&gt;&lt;BR /&gt;The output for the 3 files:&lt;BR /&gt;$ merge x*&lt;BR /&gt;aap &amp;gt; x&lt;BR /&gt;mies &amp;gt; x&lt;BR /&gt;noot &amp;gt; x&lt;BR /&gt;piet &amp;gt; xx&lt;BR /&gt;teun &amp;gt; xx&lt;BR /&gt;vuur &amp;gt; xxx</description>
      <pubDate>Wed, 06 Sep 2006 17:44:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001560#M98249</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-09-06T17:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001561#M98250</link>
      <description>Actually, with AWK there is a really 'short' solution:&lt;BR /&gt;&lt;BR /&gt;$ awk '{a[$1]=FILENAME} END {for (k in a) { print k " &amp;gt; " a[k] }}' file1 file2&lt;BR /&gt;&lt;BR /&gt;With the same sample files&lt;BR /&gt;&lt;BR /&gt;$ grep "." x*&lt;BR /&gt;x:aap&lt;BR /&gt;x:noot&lt;BR /&gt;x:mies&lt;BR /&gt;xx:noot&lt;BR /&gt;xx:mies&lt;BR /&gt;xx:teun&lt;BR /&gt;xx:piet&lt;BR /&gt;xxx:teun&lt;BR /&gt;xxx:vuur&lt;BR /&gt;&lt;BR /&gt;$ awk '{a[$1]=FILENAME} END {for (k in a) { print k " &amp;gt; " a[k] }}' x xx xxx&lt;BR /&gt;teun &amp;gt; xxx&lt;BR /&gt;vuur &amp;gt; xxx&lt;BR /&gt;mies &amp;gt; xx&lt;BR /&gt;aap &amp;gt; x&lt;BR /&gt;noot &amp;gt; xx&lt;BR /&gt;piet &amp;gt; xx&lt;BR /&gt;&lt;BR /&gt;$ awk '{a[$1]=FILENAME} END {for (k in a) { print k " &amp;gt; " a[k] }}' xxx xx x&lt;BR /&gt;teun &amp;gt; xx&lt;BR /&gt;vuur &amp;gt; xxx&lt;BR /&gt;mies &amp;gt; x&lt;BR /&gt;aap &amp;gt; x&lt;BR /&gt;noot &amp;gt; x&lt;BR /&gt;piet &amp;gt; xx&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2006 21:20:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001561#M98250</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-09-06T21:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001562#M98251</link>
      <description>&lt;!--!*#--&gt;Try the awk construct below:&lt;BR /&gt;&lt;BR /&gt;awk '{&lt;BR /&gt;    if (x[$1]) {&lt;BR /&gt;        if (FILENAME=="file2")&lt;BR /&gt;            x[$1]=FILENAME&lt;BR /&gt;    } else&lt;BR /&gt;        x[$1]=FILENAME&lt;BR /&gt;} END{for (i in x) print i" &amp;gt; "x[i]}' file1 file2</description>
      <pubDate>Thu, 07 Sep 2006 01:21:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001562#M98251</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-07T01:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: How i can merge two text files?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001563#M98252</link>
      <description>Hi,&lt;BR /&gt;thanks to all! with the last solution i have produced the correct file.&lt;BR /&gt;Best regards.&lt;BR /&gt;Francesco</description>
      <pubDate>Thu, 07 Sep 2006 03:18:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-i-can-merge-two-text-files/m-p/5001563#M98252</guid>
      <dc:creator>Francesco_13</dc:creator>
      <dc:date>2006-09-07T03:18:24Z</dc:date>
    </item>
  </channel>
</rss>

