<?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 merge files and match columns in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615176#M104544</link>
    <description>I have two tab separated data sources I want to merge together. Both files contain matching first columns, however in one file there are extra items throughout that throw the alignment off when sorted.&lt;BR /&gt;&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;#::::      File1 (en -&amp;gt; cn)&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;&lt;EN&gt;Zone 14    &lt;CN&gt;鍖哄煙 14&lt;BR /&gt;&lt;EN&gt;Zone 13    &lt;CN&gt;鍖哄煙 13&lt;BR /&gt;&lt;EN&gt;Zone 12    &lt;CN&gt;鍖哄煙 12&lt;BR /&gt;&lt;EN&gt;Zone 11    &lt;CN&gt;鍖哄煙 11&lt;BR /&gt;&lt;EN&gt;Zone 10    &lt;CN&gt;鍖哄煙 10&lt;BR /&gt;&lt;EN&gt;ZWZimbabwe &lt;CN&gt;ZW娲儏反甯冮煢&lt;BR /&gt;&lt;EN&gt;ZV Audio   &lt;CN&gt;ZV 闊抽&lt;BR /&gt;&lt;EN&gt;Zoom Video Vol     &lt;CN&gt;缂╂斁瑙嗛闊抽噺&lt;BR /&gt;&lt;EN&gt;Zoom Video Mute    &lt;CN&gt;缂╂斁瑙嗛闈欓煶&lt;BR /&gt;&lt;EN&gt;Zoom, Up and In    &lt;CN&gt;缂╂斁锛屽悜涓婂拰鏀惧偉&lt;BR /&gt;&lt;EN&gt;Zoom to:   &lt;CN&gt;髊剧ず姣斾緥:&lt;BR /&gt;&lt;EN&gt;Zoom to full screen        &lt;CN&gt;缂╂斁鑷冲叏灞&lt;BR /&gt;&lt;EN&gt;Zoom to 50%        &lt;CN&gt;缂╂斁鑷?50%&lt;BR /&gt;&lt;EN&gt;Zoom to 100%       &lt;CN&gt;缂╂斁鑷?100%&lt;BR /&gt;&lt;EN&gt;Zoom Timeline Out &lt;CN&gt;缂╁皬鏃堕棿绾&lt;BR /&gt;&lt;EN&gt;Zoom Timeline In &lt;CN&gt;鏀惧偉鏃堕棿绾?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;#::::      FILE 2 (en -&amp;gt; jp)&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;&lt;EN&gt;Zone 13    &lt;JP&gt;闋樺煙 13&lt;BR /&gt;&lt;EN&gt;Zone 12    &lt;JP&gt;闋樺煙 12&lt;BR /&gt;&lt;EN&gt;Zone 11    &lt;JP&gt;闋樺煙 11&lt;BR /&gt;&lt;EN&gt;Zone 10    &lt;JP&gt;闋樺煙 10&lt;BR /&gt;&lt;EN&gt;Zone 9     &lt;JP&gt;闋樺煙 9&lt;BR /&gt;&lt;EN&gt;Zone 8     &lt;JP&gt;闋樺煙 8&lt;BR /&gt;&lt;EN&gt;Zone 7     &lt;JP&gt;闋樺煙 7&lt;BR /&gt;&lt;EN&gt;Z-Order    &lt;JP&gt;閲嶃伃闋&lt;BR /&gt;&lt;EN&gt;Z-Order:   &lt;JP&gt;閲嶃伃闋?&lt;BR /&gt;&lt;EN&gt;Zoom Video Vol     &lt;JP&gt;銈恒兗銉?銉撱儑銈煶閲&lt;BR /&gt;&lt;EN&gt;Zoom Video Mute    &lt;JP&gt;銈恒兗銉?銉撱儑銈?銉熴儱銉笺儓&lt;BR /&gt;&lt;EN&gt;Zoom to selection. &lt;JP&gt;鍊嶇巼銈掗伕鎶炪仚銈嬨€&lt;BR /&gt;&lt;EN&gt;Zoom To:   &lt;JP&gt;鎸囧畾鍊嶇巼:&lt;BR /&gt;&lt;EN&gt;Zoom to Range      &lt;JP&gt;绡勫洸銇搞偤銉笺儬&lt;BR /&gt;&lt;EN&gt;Zoom to Page Width &lt;JP&gt;銈儯銉炽儛銈广伄骞呫伀琛ㄧ偢&lt;BR /&gt;&lt;EN&gt;Zoom Tool  &lt;JP&gt;銈恒兗銉?銉勩兗銉&lt;BR /&gt;&lt;EN&gt;Zoom to selection. &lt;JP&gt;鍊嶇巼銈掗伕鎶炪仚銈嬨€&lt;BR /&gt;&lt;EN&gt;Zoom to    &lt;JP&gt;琛ㄧ偢绡勫洸&lt;BR /&gt;&lt;EN&gt;Zoom To:   &lt;JP&gt;鎸囧畾鍊嶇巼:&lt;BR /&gt;&lt;EN&gt;Zoom To:   &lt;JP&gt;銈恒兗銉犲€嶇巼:&lt;BR /&gt;&lt;EN&gt;Zoom to Range      &lt;JP&gt;绡勫洸銇搞偤銉笺儬&lt;BR /&gt;&lt;EN&gt;Zoom to Page Width &lt;JP&gt;銈儯銉炽儛銈广伄骞呫伀琛ㄧ偢&lt;BR /&gt;&lt;EN&gt;Zoom Tool  &lt;JP&gt;銈恒兗銉?銉勩兗銉&lt;BR /&gt;&lt;EN&gt;Zoom to Full Page  &lt;JP&gt;銉氥兗銈稿叏浣撱倰琛ㄧ偢&lt;BR /&gt;&lt;EN&gt;Zoom to 50%        &lt;JP&gt;銈恒兗銉?(50%)&lt;BR /&gt;&lt;EN&gt;Zoom to 100%       &lt;JP&gt;銈恒兗銉?(100%)&lt;BR /&gt;&lt;EN&gt;Zoom Timeline Out &lt;JP&gt;銈裤偆銉犮儵銈傖兂銇府灏忚〃绀?&lt;BR /&gt;&lt;EN&gt;Zoom Timeline In &lt;JP&gt;銈裤偆銉犮儵銈傖兂銇嫛澶觥ㄧ ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So I want to end up with an english sentence in column 1, and its translated values (in Japanese &amp;amp; Chinese) in columns 2 &amp;amp; 3 - all on one line. Ideally I'd end up with all three languages on one line, but as you can see, to begin with the files are different and I can't always expect to have data in every language.&lt;BR /&gt;&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;#::::      NewFile (en -&amp;gt; cn -&amp;gt; jp)&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;&lt;EN&gt;Zone 14    &lt;CN&gt;鍖哄煙 14&lt;BR /&gt;&lt;EN&gt;Zone 13    &lt;CN&gt;鍖哄煙 13 &lt;JP&gt;闋樺煙 13&lt;BR /&gt;&lt;EN&gt;Zone 12    &lt;CN&gt;鍖哄煙 12 &lt;JP&gt;闋樺煙 12&lt;BR /&gt;&lt;EN&gt;Zone 11    &lt;CN&gt;鍖哄煙 11 &lt;JP&gt;闋樺煙 11&lt;BR /&gt;&lt;EN&gt;Zone 10    &lt;CN&gt;鍖哄煙 10 &lt;JP&gt;闋樺煙 10&lt;BR /&gt;&lt;EN&gt;Zone 9     &lt;JP&gt;闋樺煙 9&lt;BR /&gt;&lt;EN&gt;Zone 8     &lt;JP&gt;闋樺煙 8&lt;BR /&gt;&lt;EN&gt;Zone 7     &lt;JP&gt;闋樺煙 7&lt;BR /&gt;&lt;EN&gt;ZWZimbabwe &lt;CN&gt;ZW娲儏反甯冮煢&lt;BR /&gt;&lt;EN&gt;ZV Audio   &lt;CN&gt;ZV 闊抽&lt;BR /&gt;&lt;EN&gt;Zoom Video Vol     &lt;CN&gt;缂╂斁瑙嗛闊抽噺 &lt;JP&gt;銈恒兗銉?銉撱儑銈煶閲&lt;BR /&gt;&lt;EN&gt;Zoom Video Mute    &lt;CN&gt;缂╂斁瑙嗛闈欓煶 &lt;JP&gt;銈恒兗銉?銉撱儑銈?銉熴儱銉笺儓&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rather than manually aligning the content in an editor, here is my idea: run a script that&lt;BR /&gt;&lt;BR /&gt;Compares line by line: &lt;BR /&gt;1. Reads the first column of File1&lt;BR /&gt;2. Looks for a match in File2; grabs the matching line, sending it to NewFile.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;</description>
    <pubDate>Tue, 30 Aug 2005 22:18:32 GMT</pubDate>
    <dc:creator>Mark H Smith</dc:creator>
    <dc:date>2005-08-30T22:18:32Z</dc:date>
    <item>
      <title>merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615176#M104544</link>
      <description>I have two tab separated data sources I want to merge together. Both files contain matching first columns, however in one file there are extra items throughout that throw the alignment off when sorted.&lt;BR /&gt;&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;#::::      File1 (en -&amp;gt; cn)&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;&lt;EN&gt;Zone 14    &lt;CN&gt;鍖哄煙 14&lt;BR /&gt;&lt;EN&gt;Zone 13    &lt;CN&gt;鍖哄煙 13&lt;BR /&gt;&lt;EN&gt;Zone 12    &lt;CN&gt;鍖哄煙 12&lt;BR /&gt;&lt;EN&gt;Zone 11    &lt;CN&gt;鍖哄煙 11&lt;BR /&gt;&lt;EN&gt;Zone 10    &lt;CN&gt;鍖哄煙 10&lt;BR /&gt;&lt;EN&gt;ZWZimbabwe &lt;CN&gt;ZW娲儏反甯冮煢&lt;BR /&gt;&lt;EN&gt;ZV Audio   &lt;CN&gt;ZV 闊抽&lt;BR /&gt;&lt;EN&gt;Zoom Video Vol     &lt;CN&gt;缂╂斁瑙嗛闊抽噺&lt;BR /&gt;&lt;EN&gt;Zoom Video Mute    &lt;CN&gt;缂╂斁瑙嗛闈欓煶&lt;BR /&gt;&lt;EN&gt;Zoom, Up and In    &lt;CN&gt;缂╂斁锛屽悜涓婂拰鏀惧偉&lt;BR /&gt;&lt;EN&gt;Zoom to:   &lt;CN&gt;髊剧ず姣斾緥:&lt;BR /&gt;&lt;EN&gt;Zoom to full screen        &lt;CN&gt;缂╂斁鑷冲叏灞&lt;BR /&gt;&lt;EN&gt;Zoom to 50%        &lt;CN&gt;缂╂斁鑷?50%&lt;BR /&gt;&lt;EN&gt;Zoom to 100%       &lt;CN&gt;缂╂斁鑷?100%&lt;BR /&gt;&lt;EN&gt;Zoom Timeline Out &lt;CN&gt;缂╁皬鏃堕棿绾&lt;BR /&gt;&lt;EN&gt;Zoom Timeline In &lt;CN&gt;鏀惧偉鏃堕棿绾?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;#::::      FILE 2 (en -&amp;gt; jp)&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;&lt;EN&gt;Zone 13    &lt;JP&gt;闋樺煙 13&lt;BR /&gt;&lt;EN&gt;Zone 12    &lt;JP&gt;闋樺煙 12&lt;BR /&gt;&lt;EN&gt;Zone 11    &lt;JP&gt;闋樺煙 11&lt;BR /&gt;&lt;EN&gt;Zone 10    &lt;JP&gt;闋樺煙 10&lt;BR /&gt;&lt;EN&gt;Zone 9     &lt;JP&gt;闋樺煙 9&lt;BR /&gt;&lt;EN&gt;Zone 8     &lt;JP&gt;闋樺煙 8&lt;BR /&gt;&lt;EN&gt;Zone 7     &lt;JP&gt;闋樺煙 7&lt;BR /&gt;&lt;EN&gt;Z-Order    &lt;JP&gt;閲嶃伃闋&lt;BR /&gt;&lt;EN&gt;Z-Order:   &lt;JP&gt;閲嶃伃闋?&lt;BR /&gt;&lt;EN&gt;Zoom Video Vol     &lt;JP&gt;銈恒兗銉?銉撱儑銈煶閲&lt;BR /&gt;&lt;EN&gt;Zoom Video Mute    &lt;JP&gt;銈恒兗銉?銉撱儑銈?銉熴儱銉笺儓&lt;BR /&gt;&lt;EN&gt;Zoom to selection. &lt;JP&gt;鍊嶇巼銈掗伕鎶炪仚銈嬨€&lt;BR /&gt;&lt;EN&gt;Zoom To:   &lt;JP&gt;鎸囧畾鍊嶇巼:&lt;BR /&gt;&lt;EN&gt;Zoom to Range      &lt;JP&gt;绡勫洸銇搞偤銉笺儬&lt;BR /&gt;&lt;EN&gt;Zoom to Page Width &lt;JP&gt;銈儯銉炽儛銈广伄骞呫伀琛ㄧ偢&lt;BR /&gt;&lt;EN&gt;Zoom Tool  &lt;JP&gt;銈恒兗銉?銉勩兗銉&lt;BR /&gt;&lt;EN&gt;Zoom to selection. &lt;JP&gt;鍊嶇巼銈掗伕鎶炪仚銈嬨€&lt;BR /&gt;&lt;EN&gt;Zoom to    &lt;JP&gt;琛ㄧ偢绡勫洸&lt;BR /&gt;&lt;EN&gt;Zoom To:   &lt;JP&gt;鎸囧畾鍊嶇巼:&lt;BR /&gt;&lt;EN&gt;Zoom To:   &lt;JP&gt;銈恒兗銉犲€嶇巼:&lt;BR /&gt;&lt;EN&gt;Zoom to Range      &lt;JP&gt;绡勫洸銇搞偤銉笺儬&lt;BR /&gt;&lt;EN&gt;Zoom to Page Width &lt;JP&gt;銈儯銉炽儛銈广伄骞呫伀琛ㄧ偢&lt;BR /&gt;&lt;EN&gt;Zoom Tool  &lt;JP&gt;銈恒兗銉?銉勩兗銉&lt;BR /&gt;&lt;EN&gt;Zoom to Full Page  &lt;JP&gt;銉氥兗銈稿叏浣撱倰琛ㄧ偢&lt;BR /&gt;&lt;EN&gt;Zoom to 50%        &lt;JP&gt;銈恒兗銉?(50%)&lt;BR /&gt;&lt;EN&gt;Zoom to 100%       &lt;JP&gt;銈恒兗銉?(100%)&lt;BR /&gt;&lt;EN&gt;Zoom Timeline Out &lt;JP&gt;銈裤偆銉犮儵銈傖兂銇府灏忚〃绀?&lt;BR /&gt;&lt;EN&gt;Zoom Timeline In &lt;JP&gt;銈裤偆銉犮儵銈傖兂銇嫛澶觥ㄧ ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So I want to end up with an english sentence in column 1, and its translated values (in Japanese &amp;amp; Chinese) in columns 2 &amp;amp; 3 - all on one line. Ideally I'd end up with all three languages on one line, but as you can see, to begin with the files are different and I can't always expect to have data in every language.&lt;BR /&gt;&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;#::::      NewFile (en -&amp;gt; cn -&amp;gt; jp)&lt;BR /&gt;#:::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;&lt;EN&gt;Zone 14    &lt;CN&gt;鍖哄煙 14&lt;BR /&gt;&lt;EN&gt;Zone 13    &lt;CN&gt;鍖哄煙 13 &lt;JP&gt;闋樺煙 13&lt;BR /&gt;&lt;EN&gt;Zone 12    &lt;CN&gt;鍖哄煙 12 &lt;JP&gt;闋樺煙 12&lt;BR /&gt;&lt;EN&gt;Zone 11    &lt;CN&gt;鍖哄煙 11 &lt;JP&gt;闋樺煙 11&lt;BR /&gt;&lt;EN&gt;Zone 10    &lt;CN&gt;鍖哄煙 10 &lt;JP&gt;闋樺煙 10&lt;BR /&gt;&lt;EN&gt;Zone 9     &lt;JP&gt;闋樺煙 9&lt;BR /&gt;&lt;EN&gt;Zone 8     &lt;JP&gt;闋樺煙 8&lt;BR /&gt;&lt;EN&gt;Zone 7     &lt;JP&gt;闋樺煙 7&lt;BR /&gt;&lt;EN&gt;ZWZimbabwe &lt;CN&gt;ZW娲儏反甯冮煢&lt;BR /&gt;&lt;EN&gt;ZV Audio   &lt;CN&gt;ZV 闊抽&lt;BR /&gt;&lt;EN&gt;Zoom Video Vol     &lt;CN&gt;缂╂斁瑙嗛闊抽噺 &lt;JP&gt;銈恒兗銉?銉撱儑銈煶閲&lt;BR /&gt;&lt;EN&gt;Zoom Video Mute    &lt;CN&gt;缂╂斁瑙嗛闈欓煶 &lt;JP&gt;銈恒兗銉?銉撱儑銈?銉熴儱銉笺儓&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rather than manually aligning the content in an editor, here is my idea: run a script that&lt;BR /&gt;&lt;BR /&gt;Compares line by line: &lt;BR /&gt;1. Reads the first column of File1&lt;BR /&gt;2. Looks for a match in File2; grabs the matching line, sending it to NewFile.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;</description>
      <pubDate>Tue, 30 Aug 2005 22:18:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615176#M104544</guid>
      <dc:creator>Mark H Smith</dc:creator>
      <dc:date>2005-08-30T22:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615177#M104545</link>
      <description>First column of File1 will sometimes unique one as,&lt;BR /&gt;&lt;EN&gt;Zone. We can get upto &lt;CN&gt; and look for a match in File2.&lt;BR /&gt;&lt;BR /&gt;while read line; do&lt;BR /&gt;&lt;BR /&gt; match=$(echo $line | sed -e "s/&lt;CN&gt;.*//")&lt;BR /&gt; grep $match &lt;FILE2&gt; &amp;gt; &lt;NEWFILE&gt;&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; &lt;FILE1&gt;&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/FILE1&gt;&lt;/NEWFILE&gt;&lt;/FILE2&gt;&lt;/CN&gt;&lt;/CN&gt;&lt;/EN&gt;</description>
      <pubDate>Tue, 30 Aug 2005 22:58:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615177#M104545</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-08-30T22:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615178#M104546</link>
      <description>&lt;BR /&gt;I had a little trouble with your data as it seems to be unicode no?&lt;BR /&gt;Here is one approach in PERL with normal text.&lt;BR /&gt;How did you wond the &lt;EN&gt; part sorted?&lt;BR /&gt;Provide input files as arguments:&lt;BR /&gt;&lt;BR /&gt;perl x.p file1 file2 ...&lt;BR /&gt;&lt;BR /&gt;---- x.p ----&lt;BR /&gt;while ($file = shift @ARGV) {&lt;BR /&gt; open (FILE, "&amp;lt;$file") or die "Failed to open $file";&lt;BR /&gt; while (&lt;FILE&gt;) {&lt;BR /&gt; chop;&lt;BR /&gt; if (/\s+(&amp;lt;\w+&amp;gt;)/) {&lt;BR /&gt;   $english{$`}++;&lt;BR /&gt;   $foreign{$`.$1} = "$1$'";&lt;BR /&gt;   }&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt; foreach (sort keys %english) {&lt;BR /&gt; printf ("%s\t%s\t%s\n", $_, $foreign{$_."&lt;CN&gt;"},$foreign{$_."&lt;JP&gt;"&lt;BR /&gt;&lt;BR /&gt;});&lt;BR /&gt; } &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is a waekish attempt on doing unicode with normal libraries. It adds dynamically finding the languages.&lt;BR /&gt;&lt;BR /&gt;while ($file = shift @ARGV) {&lt;BR /&gt; open (FILE, "&amp;lt;$file") or die "Failed to open $file";&lt;BR /&gt; while (&lt;FILE&gt;) {&lt;BR /&gt; chop;&lt;BR /&gt; chop;&lt;BR /&gt; if (/\s.(&amp;lt;.\w.\w.&amp;gt;.)/) {&lt;BR /&gt;   $english{$`}++;&lt;BR /&gt;   $languages{$1}++;&lt;BR /&gt;   $foreign{$`.$1} = "$1$'";&lt;BR /&gt;   }&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;foreach (sort keys %languages){&lt;BR /&gt; $l[$i++]=$_;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; foreach (sort keys %english) {&lt;BR /&gt; printf ("%-50s\t%30s\t%30s\n", $_, $foreign{$_.$l[0]},$foreign{$_.$l[1]});&lt;BR /&gt; } &lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;/FILE&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/FILE&gt;&lt;/EN&gt;</description>
      <pubDate>Tue, 30 Aug 2005 23:39:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615178#M104546</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-08-30T23:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615179#M104547</link>
      <description>Could you explain what the script does, Muthukumar? It's not working for me..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein, could you also explain what the script does? It also did not work for me..</description>
      <pubDate>Wed, 31 Aug 2005 01:20:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615179#M104547</guid>
      <dc:creator>Mark H Smith</dc:creator>
      <dc:date>2005-08-31T01:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615180#M104548</link>
      <description>Hi &lt;BR /&gt;Have a look at the "join" command. It is very useful for matching lines in two files when there is uneven number of lines or a "one to many relation".</description>
      <pubDate>Wed, 31 Aug 2005 02:01:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615180#M104548</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2005-08-31T02:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615181#M104549</link>
      <description>Try this,&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;file1="file1";&lt;BR /&gt;file2="file2";&lt;BR /&gt;newfile="newfile";&lt;BR /&gt;&lt;BR /&gt;&amp;gt; $newfile&lt;BR /&gt;&lt;BR /&gt;while read line;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;  col=$(echo $line | sed 's/&lt;CN&gt;.*//')&lt;BR /&gt;  loop=0&lt;BR /&gt;  grep "$col" $file2 | while read nline;&lt;BR /&gt;  do&lt;BR /&gt;    echo $line $nline &amp;gt;&amp;gt; ${newfile}&lt;BR /&gt;    loop=1&lt;BR /&gt;  done&lt;BR /&gt;  [[ $loop -eq 0 ]] &amp;amp;&amp;amp; echo $line  &amp;gt;&amp;gt; ${newfile}&lt;BR /&gt;&lt;BR /&gt;done  &amp;lt; file1&lt;BR /&gt;&lt;BR /&gt;# end #&lt;BR /&gt;&lt;BR /&gt;## Check ###&lt;BR /&gt;&lt;BR /&gt;# cat &amp;gt; file2&lt;BR /&gt;&lt;EN&gt;Zone 13 &lt;JP&gt;K:Y 13&lt;BR /&gt;&lt;EN&gt;Zone 12 &lt;JP&gt;K:Y 12&lt;BR /&gt;&lt;EN&gt;Zone 11 &lt;JP&gt;K:Y 11&lt;BR /&gt;&lt;EN&gt;Zone 10 &lt;JP&gt;K:Y 10&lt;BR /&gt;&lt;EN&gt;Zone 9 &lt;JP&gt;K:Y 9&lt;BR /&gt;&lt;EN&gt;Zone 8 &lt;JP&gt;K:Y 8&lt;BR /&gt;&lt;EN&gt;Zone 7 &lt;JP&gt;K:Y 7&lt;BR /&gt;# cat file1&lt;BR /&gt;&lt;EN&gt;Zone 14 &lt;CN&gt;VDY 14&lt;BR /&gt;&lt;EN&gt;Zone 13 &lt;CN&gt;VDY 13&lt;BR /&gt;&lt;EN&gt;Zone 12 &lt;CN&gt;VDY 12&lt;BR /&gt;&lt;EN&gt;Zone 11 &lt;CN&gt;VDY 11&lt;BR /&gt;&lt;EN&gt;Zone 10 &lt;CN&gt;VDY 10&lt;BR /&gt;# cat scr.sh&lt;BR /&gt;file1="file1";&lt;BR /&gt;file2="file2";&lt;BR /&gt;newfile="newfile";&lt;BR /&gt;&lt;BR /&gt;&amp;gt; $newfile&lt;BR /&gt;&lt;BR /&gt;while read line;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;  col=$(echo $line | sed 's/&lt;CN&gt;.*//')&lt;BR /&gt;  loop=0&lt;BR /&gt;  grep "$col" $file2 | while read nline;&lt;BR /&gt;  do&lt;BR /&gt;    echo $line $nline&lt;BR /&gt;    loop=1&lt;BR /&gt;  done&lt;BR /&gt;  [[ $loop -eq 0 ]] &amp;amp;&amp;amp; echo $line&lt;BR /&gt;&lt;BR /&gt;done  &amp;lt; file1&lt;BR /&gt;# sh scr.sh&lt;BR /&gt;&lt;EN&gt;Zone 14 &lt;CN&gt;VDY 14&lt;BR /&gt;&lt;EN&gt;Zone 13 &lt;CN&gt;VDY 13 &lt;EN&gt;Zone 13 &lt;JP&gt;K:Y 13&lt;BR /&gt;&lt;EN&gt;Zone 12 &lt;CN&gt;VDY 12 &lt;EN&gt;Zone 12 &lt;JP&gt;K:Y 12&lt;BR /&gt;&lt;EN&gt;Zone 11 &lt;CN&gt;VDY 11 &lt;EN&gt;Zone 11 &lt;JP&gt;K:Y 11&lt;BR /&gt;&lt;EN&gt;Zone 10 &lt;CN&gt;VDY 10 &lt;EN&gt;Zone 10 &lt;JP&gt;K:Y 10&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/JP&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/CN&gt;</description>
      <pubDate>Wed, 31 Aug 2005 04:33:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615181#M104549</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-08-31T04:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615182#M104550</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;you can try this script, using your input files as  $1 and $2:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read line1&lt;BR /&gt;do&lt;BR /&gt;        F1=$(echo "$line1" | awk -F"&lt;CN&gt;" '{print $1}')&lt;BR /&gt;        F11=$(echo "$line1" | awk -F"&lt;CN&gt;" '{print $2}')&lt;BR /&gt;        while read line2&lt;BR /&gt;        do&lt;BR /&gt;                F2=$(echo "$line2" | awk -F"&lt;JP&gt;" '{print $1}')&lt;BR /&gt;                F22=$(echo "$line2" | awk -F"&lt;JP&gt;" '{print $2}')&lt;BR /&gt;                if [ "$F1" = "$F2" ]&lt;BR /&gt;                then&lt;BR /&gt;                        echo "${F1}&lt;CN&gt;${F11}&lt;JP&gt;${F22}"&lt;BR /&gt;                else&lt;BR /&gt;                        continue&lt;BR /&gt;                fi&lt;BR /&gt;        done &amp;lt; $2&lt;BR /&gt;done &amp;lt; $1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;However, it takes years to execute....&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;/JP&gt;&lt;/CN&gt;&lt;/JP&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/CN&gt;</description>
      <pubDate>Wed, 31 Aug 2005 04:59:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615182#M104550</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-08-31T04:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615183#M104551</link>
      <description>Hi Mark,&lt;BR /&gt;you can use the join command to solve your problem.&lt;BR /&gt;The files ghave to have a filed separator "|" (you can quickly chnage tabs to this by tr or vi) and the second file has to contain all the key. both files have to be sorted.&lt;BR /&gt;i.e.: &lt;BR /&gt;cat file1&lt;BR /&gt;&lt;EN&gt;Zone 10|&lt;CN&gt;VÃ Y 10&lt;BR /&gt;&lt;EN&gt;Zone 11|&lt;CN&gt;VÃ Y 11&lt;BR /&gt;&lt;EN&gt;Zone 12|&lt;CN&gt;VÃ Y 12&lt;BR /&gt;&lt;EN&gt;Zone 13|&lt;CN&gt;VÃ Y 13&lt;BR /&gt;&lt;BR /&gt;cat file2&lt;BR /&gt;&lt;EN&gt;Zone 10|&lt;JP&gt;Ã :Y 10&lt;BR /&gt;&lt;EN&gt;Zone 11|&lt;JP&gt;Ã :Y 11&lt;BR /&gt;&lt;EN&gt;Zone 12|&lt;JP&gt;Ã :Y 12&lt;BR /&gt;&lt;EN&gt;Zone 13|&lt;JP&gt;Ã :Y 13&lt;BR /&gt;&lt;EN&gt;Zone 8|&lt;JP&gt;Ã :Y 8&lt;BR /&gt;&lt;EN&gt;Zone 9|&lt;JP&gt;Ã :Y 9&lt;BR /&gt;&lt;BR /&gt;join -a2 -t"|" -j1 1 -j2 1 -o 2.1,1.2,2.2 file1 file2&lt;BR /&gt;&lt;EN&gt;Zone 10|&lt;CN&gt;VÃ Y 10|&lt;JP&gt;Ã :Y 10&lt;BR /&gt;&lt;EN&gt;Zone 11|&lt;CN&gt;VÃ Y 11|&lt;JP&gt;Ã :Y 11&lt;BR /&gt;&lt;EN&gt;Zone 12|&lt;CN&gt;VÃ Y 12|&lt;JP&gt;Ã :Y 12&lt;BR /&gt;&lt;EN&gt;Zone 13|&lt;CN&gt;VÃ Y 13|&lt;JP&gt;Ã :Y 13&lt;BR /&gt;&lt;EN&gt;Zone 8||&lt;JP&gt;Ã :Y 8&lt;BR /&gt;&lt;EN&gt;Zone 9||&lt;JP&gt;Ã :Y 9&lt;BR /&gt;&lt;BR /&gt;join files by first field keeping records in file2 which haven't key in file1 writing in output file1.field1,file1.field2,file2.filed2&lt;BR /&gt;&lt;BR /&gt;type man join for furhet info&lt;BR /&gt;&lt;BR /&gt;Hope this solve your problem&lt;BR /&gt;Art&lt;BR /&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/JP&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;&lt;/CN&gt;&lt;/EN&gt;</description>
      <pubDate>Wed, 31 Aug 2005 07:35:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615183#M104551</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2005-08-31T07:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615184#M104552</link>
      <description>Mark&amp;gt;&amp;gt; Hein, could you also explain what the script does? It also did not work for me&lt;BR /&gt;&lt;BR /&gt;Sure... I often do, but it was late. I also failed to add to check out 'join' as i intended. That may do the job, but with less control/options.&lt;BR /&gt;&lt;BR /&gt;I suspected problems with unicode chars. I could not nicely 'paste' the data from your topic into a Unix window. Windows accepted it, but suggested to store as unicode. The partially pasted sample does work with my first script on a Unix box. Try that? For better help, and any future questions, be sure to ATTACH the real data (in a txt document?) as the forum munges tabs and spaces.&lt;BR /&gt;&lt;BR /&gt;Anyways.... my first script:&lt;BR /&gt;&lt;BR /&gt;1) loop over input arguments (allows for more than 2 lanugage files some day)&lt;BR /&gt;2) open current input file&lt;BR /&gt;3) loop through current input file&lt;BR /&gt;4) chop to drop newline for future 'append'.&lt;BR /&gt;5) if you see whitespace followed by "&amp;lt;", a word, and "&amp;gt; then it looks like a useful line.&lt;BR /&gt;6) take everything 'left' of the matched string a key for a list of english words.&lt;BR /&gt;7) create a list of translated words using the englisgh key, with the language appended to the key, storign the value for that combo.&lt;BR /&gt;8) when all the loops are done, look through all the english words (from whatever input file) and make a print line with the english, the looked-up value for the translated values (if any)!&lt;BR /&gt;&lt;BR /&gt;You may wnat to replace the \s+ with \t for just a tab.&lt;BR /&gt;&lt;BR /&gt;The second example dealt with the files stored as unicode in a crummy way by just treating each 16 bit unicode char as a single char plus '.' = any-char.&lt;BR /&gt;&lt;BR /&gt;It also 'counts' each foreign language usage, with the main intent to just register that language.&lt;BR /&gt;&lt;BR /&gt;After the input loops it then make and inventory of the languages seen and uses those to select the foreing language entries.&lt;BR /&gt;Currently hardcoded as just 2, but easily expanded to a loop over more language if that is ever needed.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.</description>
      <pubDate>Wed, 31 Aug 2005 08:00:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615184#M104552</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-08-31T08:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: merge files and match columns</title>
      <link>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615185#M104553</link>
      <description>Many thanks for everyone's replies, answers, suggestions and explanations.&lt;BR /&gt;&lt;BR /&gt;My file was encoded in UTF8 and then pasted from Linux into IE on a Windows box (in order to post here on ITRC). If you're a Chinese or Japanese reader you'll notice the characters don't appear quite right, but you get the general idea I think.&lt;BR /&gt;&lt;BR /&gt;My file is several million lines long and after some testing on this snippet, I think I'm going to try the "join" solution -- very fast.</description>
      <pubDate>Wed, 31 Aug 2005 18:11:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/merge-files-and-match-columns/m-p/3615185#M104553</guid>
      <dc:creator>Mark H Smith</dc:creator>
      <dc:date>2005-08-31T18:11:17Z</dc:date>
    </item>
  </channel>
</rss>

