LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-24-2013, 11:43 AM   #1
wuthering
Member
 
Registered: Mar 2013
Location: planet earth
Distribution: Fedora 17
Posts: 44

Rep: Reputation: Disabled
Wink file divided into multiple pieces


Hi everybody,

Someone has split my audio class lessons and some songs I put on my smartphone into multiple pieces: I guess he or she used the "split utility" to do this in order to make me angry but how could I use the "join utility" to mend the files?

Thanx,

Wuthering
 
Old 03-24-2013, 12:11 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
There is no join utility, but you can easily use cat, like this:
Code:
cat part1 part2 part3 part4 >joined_file
 
Old 03-24-2013, 12:12 PM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
What are the names of the pieces? Can you post an example? If you are sure they have been divided using the split utility, you can assemble pieces using cat. Just pay attention to put the names of the pieces in the correct order. Example:
Code:
cat xaa xab xac xad xae xaf > output_file
or
Code:
cat file.part1 file.part2 file.part3 file.part4 > output_file
the result will have exactly the same sequence of bytes as the original file. If you're sure they have been divided by split!

Edit: beaten by TobiSGD!
 
Old 03-24-2013, 12:38 PM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
@TobiSGD/colucix:
I am just currious... Can cat create a full music file (i.e. may be mp3 clips) from pieces of file?
 
Old 03-24-2013, 12:55 PM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by shivaa View Post
@TobiSGD/colucix:
I am just currious... Can cat create a full music file (i.e. may be mp3 clips) from pieces of file?
Of course. It simply put bytes in sequence and it doesn't make any difference among file types. On the other hand, every file is a pure sequence of bits: it is the software that interpret the sequences in one way or another. cat simply concatenates the pieces and doesn't make any attempt to interpret them, nor changes them in any way.
 
1 members found this post helpful.
Old 03-24-2013, 01:06 PM   #6
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by colucix View Post
Of course. It simply put bytes in sequence and it doesn't make any difference among file types. On the other hand, every file is a pure sequence of bits: it is the software that interpret the sequences in one way or another. cat simply concatenates the pieces and doesn't make any attempt to interpret them, nor changes them in any way.
Agree. That means, if I want to combine two mp3 files or clips i.e. song1.mp3 and song2.mp3, I can use cat to combine them... right?
Code:
~$ cat song1.mp3 song2.mp3 > newsong.mp3
 
Old 03-24-2013, 01:25 PM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Yes and no. The situation you describe is totally different from joining pieces coming from one original file. A mp3 file has a header that contains information about the bit-rate, the audio codec and so on. If you concatenate two mp3 using cat, this information is not updated and it remains related to the first file, not to the resulting mp3. Nevertheless an audio player can still play the file and you will listen to two songs in sequence. However I think it is a matter of luck in this case!
 
Old 03-24-2013, 02:13 PM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by colucix View Post
Yes and no. The situation you describe is totally different from joining pieces coming from one original file. A mp3 file has a header that contains information about the bit-rate, the audio codec and so on. If you concatenate two mp3 using cat, this information is not updated and it remains related to the first file, not to the resulting mp3. Nevertheless an audio player can still play the file and you will listen to two songs in sequence. However I think it is a matter of luck in this case!
I wouldn't be too sure that an audioplayer will play both parts of such a file. MP3 files can have two blocks of metadata, one in the last 128 bytes of the file (ID3v1) and one in the beginning of the file (size dependend on content, up to 16 so called frames with a maximum of 16MB each, so maximum 256MB, ID3v2). I wouldn't expect any audioplayer to handle files correctly were these chunks of data appear on places were they are not expected, for example when you concatenate a file with ID3v1 and a file with ID3v2 in a way that the metadata is in the middle of the new file. With files without metadata colucix should be correct, since MP3 files have not only one header, but many of them, so that a change in bitrate or other variables shouldn't make any differences.

MP3 file structure: https://en.wikipedia.org/wiki/Mp3#File_structure
ID3 tags: https://en.wikipedia.org/wiki/ID3
 
Old 03-24-2013, 02:34 PM   #9
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Thanks for the clarification, TobiSGD!
Quote:
Originally Posted by TobiSGD View Post
I wouldn't expect any audioplayer to handle files correctly were these chunks of data appear on places were they are not expected, for example when you concatenate a file with ID3v1 and a file with ID3v2 in a way that the metadata is in the middle of the new file.
Indeed, I tried with two files having the same ID3 version (ID3v2). This probably explains the "matter of luck" I mentioned in my previous post!
 
Old 03-25-2013, 02:20 PM   #10
wuthering
Member
 
Registered: Mar 2013
Location: planet earth
Distribution: Fedora 17
Posts: 44

Original Poster
Rep: Reputation: Disabled
Wink

@colucix :is the any other utility to split a mp3 file and corrupt a song and how can I get the information about the corrupted file I want to mend to check if it is therefore the split utility used by the guy?

tomorrow, I will be able to give you more details as I don't have the cable to connect my smartphone with the computer.

Thanx everybody for your useful answers.

wuthering.
 
Old 03-25-2013, 02:32 PM   #11
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Instead of the split utility you also can use any audio editor to split the file into multiple smaller ones. In this case you would even be able to play any chunk independent from the others.
To test if the person that did this really used split (or a similar working tool) the best and simplest option is to just launch the cat command to join them and try if you can play it.
 
Old 04-12-2013, 02:37 PM   #12
wuthering
Member
 
Registered: Mar 2013
Location: planet earth
Distribution: Fedora 17
Posts: 44

Original Poster
Rep: Reputation: Disabled
to TobiSGD:
as I am a newbie on linux, I don't know how to use the cat utility , I mean : I transfered the corrupted files from my smartphone to my computer and I put it in /home.
But what shall I write in the shell ? I must give details : for example it is a file of german class lessons but for each file , it is complete indeed but when I listen to it, it is as if it is splited, I don't know if I am clear enough: it it as if you have your mp3 cd device that bugs when you listen to the music. Do you understand ?
 
Old 04-13-2013, 03:05 PM   #13
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Try it with this command
Code:
cat file1 file2 file3 file4 > newfile
Of course you have tp use the real filenames here.
 
Old 04-13-2013, 03:29 PM   #14
wuthering
Member
 
Registered: Mar 2013
Location: planet earth
Distribution: Fedora 17
Posts: 44

Original Poster
Rep: Reputation: Disabled
Exclamation

you did not understand <moderated>

Last edited by colucix; 04-14-2013 at 09:52 AM. Reason: Removed colorful language.
 
Old 04-13-2013, 05:21 PM   #15
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If I misunderstood you then please try to explain what you mean in a different way. If you have problems to do that because English is not your native language it may be easier for you to e-mail me and explain your problem in German (since you mentioned German lessons).

Also, please remove those insults, this forum is not a place for that.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] 1TB disk divided into 3 partitions trinityforce Linux - Newbie 6 10-07-2011 01:54 PM
how to cut an existing file into pieces without space dtimms Linux - Software 6 11-27-2009 07:45 AM
Divide a big file into small pieces, each has same number of lines Kunsheng Linux - Software 1 10-16-2009 04:08 PM
System Backup - TAR file in Pieces by 4.7GB .... skate Linux - Server 6 08-09-2008 07:30 PM
How to cut a big file into pieces of a certain size? kornerr Linux - General 9 12-31-2005 03:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration