Home
Forum
Software
Mouser's Software
NANY: New Apps for the New Year
Friends of DC
Forum Coding Snacks
Editorials
Daily Blog
Monthly Newsletter
Mini Reviews
Favorite Websites
Archives
Articles
Historical Archives
Testimonials: What Folks Say About Us
Licensing
Get a License Key
Commercial Licensing
Help
Search
FAQs
DonationCoder Sitemap
Live Chat (Discord)
Contact Us
About Us
Donate
Home
Forum
Software
Mouser's Software
NANY: New Apps for the New Year
Friends of DC
Forum Coding Snacks
Editorials
Daily Blog
Monthly Newsletter
Mini Reviews
Favorite Websites
Archives
Articles
Historical Archives
Testimonials: What Folks Say About Us
Licensing
Get a License Key
Commercial Licensing
Help
Search
FAQs
DonationCoder Sitemap
Live Chat (Discord)
Contact Us
About Us
Donate
This topic
This board
Entire forum
Website and forum (google)
Member search
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
6 Months
Forever
Login with username, password and session length
Saturday December 14, 2024, 10:23 am
Proudly celebrating 15+ years online.
Donate now
to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
Forum Home
Search
Login
Register
Recent Topics
Go To..
Recently updated topics
Recent posts (compact)
Recent posts (full text)
DonationCoder.com Forum
»
DonationCoder.com Software
»
Coding Snacks
»
Post New Requests Here
»
IDEA: Delete first x bytes of a binary file
« previous
next »
New Topic
Print
Pages: [
1
] •
bottom
Author
Topic: IDEA: Delete first x bytes of a binary file (Read 5965 times)
Killeroid
Participant
Joined in 2007
Posts:
8
IDEA: Delete first x bytes of a binary file
«
on:
January 06, 2009, 01:59 AM »
I have a folder full of binary files. The first 18 bytes of each file needs to be deleted. Maybe someone can help? Thanks in advance
Killeroid
Participant
Joined in 2007
Posts:
8
Re: IDEA: Delete first x bytes of a binary file
«
Reply #1 on:
January 06, 2009, 02:29 AM »
Alright, I finally found a fix using bash and dd on linux.
Code: Text
[Select]
#!/bin/bash
#Reads all files ending in specified extension in folder, deletes first X bytes and then saves the modified file as prefix.oldname
X=18 #Number of bytes to delete from file
EXT=jpg #File extension of files being modified
PREFIX=new #The prefix prepended to the filename to after moifying the file
for file in $(echo *.$EXT); do dd ibs=$X skip=1 if=${file} of=$PREFIX.${file}; done
«
Last Edit: January 06, 2009, 03:12 AM by Killeroid
»
f0dder
Charter Honorary Member
Joined in 2005
Posts:
9,153
[Well, THAT escalated quickly!]
Re: IDEA: Delete first x bytes of a binary file
«
Reply #2 on:
January 06, 2009, 12:23 PM »
Just out of curiosity: why do you need those 18 bytes (jpeg header?) deleted?
- carpe noctem
Killeroid
Participant
Joined in 2007
Posts:
8
Re: IDEA: Delete first x bytes of a binary file
«
Reply #3 on:
January 06, 2009, 12:51 PM »
All the files were encoded wrongly before transit and when i got them, all of them had 18 bytes of junk prepended to each file.
lanux128
Global Moderator
Joined in 2005
Posts:
6,277
Re: IDEA: Delete first x bytes of a binary file
«
Reply #4 on:
May 12, 2009, 08:25 AM »
what is a good Windows CLI tool to delete malformed headers like the one Killeroid used?
New Topic
Print
Pages: [
1
] •
top
« previous
next »
DonationCoder.com Forum
»
DonationCoder.com Software
»
Coding Snacks
»
Post New Requests Here
»
IDEA: Delete first x bytes of a binary file