DonationCoder.com Software > Post New Requests Here
IDEA: Delete first x bytes of a binary file
(1/1)
Killeroid:
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:
Alright, I finally found a fix using bash and dd on linux.
--- Code: Text ---#!/bin/bash#Reads all files ending in specified extension in folder, deletes first X bytes and then saves the modified file as prefix.oldnameX=18 #Number of bytes to delete from fileEXT=jpg #File extension of files being modifiedPREFIX=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
f0dder:
Just out of curiosity: why do you need those 18 bytes (jpeg header?) deleted?
Killeroid:
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:
what is a good Windows CLI tool to delete malformed headers like the one Killeroid used?
Navigation
[0] Message Index
Go to full version