Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'll get straight to the point - I have four files that I want to combine together but with an offset applied to each file. So fileA starts at 0x00, fileB starts at 0x9C4000, fileC starts at 0xCB2000 and fileD starts at 0xCC0000. What fills the gap between files is not important, what is important is the start byte location of each file. FileA is .SREC file, B is a .xmp file, C is .html file and D is .js file. The output file can output in the form of a text file.
I have tried "cat" but there doesn't seem to be an option to control how the files are concatinated.
Could you show us some sample with dummy entries? Many commands and combination of commands can do this, but without visualizing the requirement, it's not appropriate to suggest anything.
The output file combining Files A,B,C,D should be in the form of the following. The gaps between each file start point can be filled with 0's. I hope this explains it a little better.
FileA - start byte 0 - Filetype .SREC (this line not needed in output)
S02B0000533A2F50726F6A656374732F495349535F43686F70706572732F4D4B335F4D504455312F4649524DA7
S315000000009421FF609001002490410028BC61002CDF
S315000000107C0802A6900100107C0902A6900100143B
..."continues with many similar lines"
S315FFFFFFEC3C000000600020C47C0803A64E80002066
S309FFFFFFFC4BFFFFF0C4
S705FFFFFFFC01
000000000000000000000 - as many '0' required to fill file to 0x9c4000 or byte number 10,239,999
FileB start byte 10,240,00 - Filetype .xap (this is a bin file and hence characters do not display properly, this line not needed in output)
PK
p~Ať{ lv
..."continues with many similar lines unable to display in this box"
@
000000000000000000000 - as many '0' required to fill file to 0xCB2000 or byte number 13,311,999
FileC start byte 13,312,000 - Filetype .html (this line not needed in output)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
..."continues with many similar lines"
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>
</body>
</html>
000000000000000000000 - as many '0' required to fill file to 0xCC0000 or byte number 13,369,343
FileD start byte 13,369,344 - filetype .js (this line not needed in output)
//v2.0.30511.0
if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverl ightInstalledCalled=false;Silverlight.fwlinkRoot="http
..."continues with many similar lines"
__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c}
Many thanks for the reply. I keep getting "truncate : command not found" when I run this. Has this function / prototype got to be included somehow? I am using RH5 if this helps.. If I "man truncate" it comes up with the doc for it but doesn't execute. I see it's in unistd.h and sys/types.h, any pointers???
If I "whereis truncate" I get "truncate: /usr/share/man/man3p/truncate.3p.gz /usr/share/man/man2/truncate.2.gz"
So it seems I have the manual for it but it's a function that is not installed on our systems. Nothing I can do about that unfortunately but I'm sure it would have worked all the same. I'll have a chat with our IT guys and see if it can be installed. Also, it might be a permission thing..
I tried it last night and it seems to have worked. I will try to program the file into the flash memory today to see if it locates the files in the correct places and let you know how it goes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.