Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 16th, 2015, 11:31 AM
anupamjamatia anupamjamatia is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2015
Posts: 1 anupamjamatia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 58 sec
Reputation Power: 0
How to merge first two files based on the condition of third file

Hello, I have two text files say CMU.txt and SNLTR.txt file which I have to merge based on the condition of En_Hi.txt files.

In the En_Hi.txt files if the tag is hindi (hi) it will choose from SNLTR file if the tag in En_Hi.txt file is english (en) it will choose from CMU.txt file.
Can anyone give some highlight on this matter please.
please find the contents of the three files here.

CMU.txt file have
---------------------
kuch§NNP bhi§NNP max§NNP
Vivekanand§NNP Narayan§NNP Vedang§NNP Chauhan§NNP Pragyensh§NNP Kumar§NNP Harsh§JJ Kumar§NNP Narula§NNP Mritunjay§NNP Tiwari§NNP That§DT reminds§VBZ me§PRP of§IN something§NN .§.
Reminds§VBZ me§PRP of§IN Ravi§NNP Bhoraskar§NNP Jaspreet§NNP Saluja§NNP Shainky§NNP !§.

SNLTR.txt file have
--------------------------
kuch§JQ bhi§NC max§VM
Vivekanand§RDF Narayan§RDF Vedang§RDF Chauhan§RDF Pragyensh§RDF Kumar§RDF Harsh§RDF Kumar§RDF Narula§RDF Mritunjay§RDF Tiwari§RDF That§RDF reminds§RDF me§RDF of§RDF something§RDF .§PU
Reminds§NC me§PP of§RDF Ravi§RDF Bhoraskar§RDF Jaspreet§RDF Saluja§RDF Shainky§RDF !§PU

En_Hi.txt file have
-------------------------
kuch$hi bhi$hi max$en
Vivekanand$hi Narayan$hi Vedang$hi Chauhan$hi Pragyensh$hi Kumar$hi Harsh$en Kumar$hi Narula$hi Mritunjay$hi Tiwari$hi That$en reminds$en me$en of$en something$en .$univ
Reminds$en me$en of$en Ravi$hi Bhoraskar$hi Jaspreet$hi Saluja$hi Shainky$hi !$univ



Thanks and Regards
AJ

Reply With Quote
  #2  
Old April 12th, 2015, 11:55 PM
arbynherr arbynherr is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2015
Location: South Australia
Posts: 4 arbynherr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 12 sec
Reputation Power: 0
To be honest I didn't understand your code. Try to use proper space and margins for that.

Reply With Quote
  #3  
Old May 8th, 2017, 01:17 AM
javanovice javanovice is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2017
Posts: 2 javanovice User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 29 sec
Reputation Power: 0
Quote:
Originally Posted by anupamjamatia
Hello, I have two text files say CMU.txt and SNLTR.txt file which I have to merge based on the condition of En_Hi.txt files.

In the En_Hi.txt files if the tag is hindi (hi) it will choose from SNLTR file if the tag in En_Hi.txt file is english (en) it will choose from CMU.txt file.
Can anyone give some highlight on this matter please.
please find the contents of the three files here.

CMU.txt file have
---------------------
kuch§NNP bhi§NNP max§NNP
Vivekanand§NNP Narayan§NNP Vedang§NNP Chauhan§NNP Pragyensh§NNP Kumar§NNP Harsh§JJ Kumar§NNP Narula§NNP Mritunjay§NNP Tiwari§NNP That§DT reminds§VBZ me§PRP of§IN something§NN .§.
Reminds§VBZ me§PRP of§IN Ravi§NNP Bhoraskar§NNP Jaspreet§NNP Saluja§NNP Shainky§NNP !§.

SNLTR.txt file have
--------------------------
kuch§JQ bhi§NC max§VM
Vivekanand§RDF Narayan§RDF Vedang§RDF Chauhan§RDF Pragyensh§RDF Kumar§RDF Harsh§RDF Kumar§RDF Narula§RDF Mritunjay§RDF Tiwari§RDF That§RDF reminds§RDF me§RDF of§RDF something§RDF .§PU
Reminds§NC me§PP of§RDF Ravi§RDF Bhoraskar§RDF Jaspreet§RDF Saluja§RDF Shainky§RDF !§PU

En_Hi.txt file have
-------------------------
kuch$hi bhi$hi max$en
Vivekanand$hi Narayan$hi Vedang$hi Chauhan$hi Pragyensh$hi Kumar$hi Harsh$en Kumar$hi Narula$hi Mritunjay$hi Tiwari$hi That$en reminds$en me$en of$en something$en .$univ
Reminds$en me$en of$en Ravi$hi Bhoraskar$hi Jaspreet$hi Saluja$hi Shainky$hi !$univ



Thanks and Regards
AJ


Find the below method to merge two files


OPEN INPUT FILE1, FILE2.
DISPLAY FS1, FS2.
OPEN OUTPUT FILE3.
DISPLAY FS3.
PERFORM UNTIL EOF = 'YES'
READ FILE1 AT END MOVE 'YES' TO EOF
PERFORM CLOSE-PARA
NOT AT END
READ FILE2 AT END MOVE 'YES' TO EOF
PERFORM CLOSE-PARA
NOT AT END
IF EMPNO1 = EMPNO2
MOVE
REC1 TO REC3
WRITE REC3
MOVE
REC2 TO REC3
WRITE REC3
END-PERFORM.
CLOSE-PARA.
CLOSE FILE1, FILE2, FILE3.
STOP RUN.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > How to merge first two files based on the condition of third file


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap