Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Merging files  RSS feed

 
himanshu patel
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am very sorry if this is not the right forum to ask.
Basically this is a MS-DOS problem.
I am merging multiple files into one file with DOS "copy" command.
Ex.
copy file1 + file2 + file3 mergeOurFile
The problem here is at the end of merged output file , it inserts EOF
character.I want to remove this unwanted EOF charachter.
I could have done merging files through Java by reading and appending content, But i feel executing DOS command through Java is little faster.
How can I remove this quickly.I can do manyally but there are many
merged files to do so.
Can anyone give me better solution to do this?
Please suggest any better way to merge files ?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that I understand the problem. Isn't there always an EOF character at the end of a file by definition?
On a related note, I usually use java for everything so the code is not tied to a specific platform.
 
himanshu patel
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After merging, at the end of the file, it shows one junk character which looks like EOF character.If i open same file in Linux VI editor, it shows
^Z. I think if you try copying 2 sample file,you will see what that exact character is.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to add a trailing /b to the command, which means 'binary'. (Aren't textfiles stored binary? perhaps tertiary? or analog?)

This will avoid the EOF - mark (which is very silly in files).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!