LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   concatenate binary files???? (https://www.linuxquestions.org/questions/linux-newbie-8/concatenate-binary-files-2465/)

justin19fl 05-12-2001 05:47 PM

How can I concatenate two binary files. They were originally split with a file-splitter so that they would fit on floppies. The file-splitter created a batch file to put them back together. The batch file uses this command: "copy /B file1 + file2 file3" (without quotes). I looked at the man page for cat, but I didn't see any parameters to use for binary files. What should I do?

justin19fl 05-12-2001 05:53 PM

The whole reason I got into this mess is that I can't get online with Linux (My parents use AOL :( ), and because I can't access my DOS disk from Linux. If anyone knows of a free ISP for Linux or a way to access my DOS disk, please help. Please explain in as simple terms as you can because I'm new to Linux.

Thymox 05-13-2001 04:26 PM

Not sure about the concatenating, but:

First, think back - when you repartitioned your HD, did you erase your Windows partition(s)? If the answer is yes, then I'm affraid that you've lost all of the files that were under Windows. If the answer is no, then don't stress.

Using Konqueror (the program that behaves like Windows Explorer) move to your '/mnt' directory. Are there any subdirectories called 'windows' or 'win_c' or the like? You should already have a 'cdrom', 'floppy' and 'disk' (I'm not sure what this last one's for). If you have, and it has a padlock over it, log in as root. If you can now access it, then there you go. It's here!

If there aren't any subdirectories called 'windows' or 'win_c' then make one. Make sure you're logged in as root. Open a terminal window and type:

mount vfat /hda1 /mnt/windows

You should be able to access it now. This is only a temporary measure, you need to read up about your 'fstab' for a more permanent solution. Either look for a HowTo on 'fstab' or type 'man fstab' from a terminal window.

Can't be of anymore help tonight, my university computer turns itself off at 22:30 GMT (4 mins time).

Good luck anyway.

justin19fl 05-13-2001 05:56 PM

Ok, I figured out how to access my Windows disk. I used linuxconf instead of your mount command so it leaves an icon on my desktop to automatically mount and open gmc, but I still want to know how I can concatenate binary files, and I'm still looking for a free ISP.

Thymox 05-14-2001 09:44 AM

I'm no great programmer (hence the 'Basic Under Linux' thread) but I believe that this should work:

Copy the 1st bin to a new one and then append the second to it, like:

cp filea.bin newfile.bin
cat fileb.bin >> newfile.bin


The double '>>' is important. A single '>' will overwrite the contents of 'newfile.bin' with 'fileb.bin', so you won't have achieved much!

Don't forget to change the file permissions so that you can run the 'newfile.bin'.

justin19fl 05-14-2001 02:10 PM

Ok, I know that doesn't work in DOS, but maybe Linux does it differently. With DOS you will automatically get an EOF code at the end of the FIRST binary file, along with the EOF code at the end of the end of the second (creating a binary with 2 EOF codes). If I remember correctly it isn't good to even have 1 EOF code in a binary file, but I'm not sure how Linux treats ascii and binary files, so that could work.

justin19fl 05-14-2001 02:13 PM

The DOS command is COPY /B FILE1 + FILE2 FILE3. The /B switch causes it to copy in binary mode, but Linux might already copy in binary mode by default.


All times are GMT -5. The time now is 09:53 AM.