Bin files saved as txt.. Convert
Re: Bin files saved as txt.. Convert
its less a formula and more a process... there are better easier ways of doing it but I was bored. you have to split it into 5 or so sections as excel runs out of resources (at least on my pc) after about 10,000 rows.
paste data into cell A2, in cell B2 use formula =B1&A2 then double click the little square in the corner to fill down the formula. scroll to the last row to get hte whole long string, then copy that and paste into your hex editor. make sure the last byte in the string you copied isnt one character.
I would use one of the perl scripts if there were heaps to fix.
paste data into cell A2, in cell B2 use formula =B1&A2 then double click the little square in the corner to fill down the formula. scroll to the last row to get hte whole long string, then copy that and paste into your hex editor. make sure the last byte in the string you copied isnt one character.
I would use one of the perl scripts if there were heaps to fix.
Re: Bin files saved as txt.. Convert
well if you're using windows, replace "cat" with "type" and you'll be in business
the | feeds the output of "type 84.txt" to perl (i.e the contents of the txtfile), the "-e" flag is for "read the perl commands from the cmdline" and -n is "assume a while() loop around reading the input lines", chomp takes care of the CR/LF, chr prints the character specified by the ascii number following, which is wrapped in a hex() to convert the contents of the line from hexadecimal to suit the chr command if that makes it any clearer?
the | feeds the output of "type 84.txt" to perl (i.e the contents of the txtfile), the "-e" flag is for "read the perl commands from the cmdline" and -n is "assume a while() loop around reading the input lines", chomp takes care of the CR/LF, chr prints the character specified by the ascii number following, which is wrapped in a hex() to convert the contents of the line from hexadecimal to suit the chr command if that makes it any clearer?
-
- Posts: 2883
- Joined: Sun Aug 02, 2009 9:16 pm
- Location: Bayside, Melbourne, Victoria
- Contact:
Re: Bin files saved as txt.. Convert
Clear as MUD, no seriously I'll look into it when I get a chance again (my parts just arrived been waiting all day 1st lot they sent were wrong).
Jayme, yeah it would probably max out this PC's resources too so need to split it up, but I also need to find out how to use more of excel's formulas as there's kalmaker dif files that I'd love to seperate each line into columns & sure excel could do it but haven't figured it out yet!
Jayme, yeah it would probably max out this PC's resources too so need to split it up, but I also need to find out how to use more of excel's formulas as there's kalmaker dif files that I'd love to seperate each line into columns & sure excel could do it but haven't figured it out yet!
- antus
- Site Admin
- Posts: 8253
- Joined: Sat Feb 28, 2009 8:34 pm
- cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B - Contact:
Re: Bin files saved as txt.. Convert
haha, i used bash and sed and padded/aligned with dd, went to post back and Jaymes answer was in
Code: Select all
$ cat hex2bin
#!/bin/bash
echo -n -e $(tr -d '[:space:]' | sed 's/../\\x&/g')
$ cat OLD\ VS\ \$84\ File.txt | ./hex2bin > 84fixed.bin
$ (dd if=/dev/zero count=24576 bs=1 ; cat 84fixed.bin) > 84fixed2.bin
$ ls -l 84fixed2.bin
-rw-r--r-- 1 ant ant 65536 Dec 14 14:11 84fixed2.bin
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
Re: Bin files saved as txt.. Convert
you could have also used dd's seek= arg to write to the correct offset, but that's pretty neat anyway
I was going to use s+a, but after being up working all night I chose the easiest option
I was going to use s+a, but after being up working all night I chose the easiest option
- Holden202T
- Posts: 10311
- Joined: Sat Feb 28, 2009 9:05 pm
- Location: Tenambit, NSW
- Contact:
Re: Bin files saved as txt.. Convert
No matter what the question is, the answer is always more horsepower!
Just starting out? Have a read of the getting started guide
Basic tuning of a delco ECM with $12P thread
Advanced tuning of a delco ECM with $12P thread
Just starting out? Have a read of the getting started guide
Basic tuning of a delco ECM with $12P thread
Advanced tuning of a delco ECM with $12P thread
-
- Posts: 2883
- Joined: Sun Aug 02, 2009 9:16 pm
- Location: Bayside, Melbourne, Victoria
- Contact:
Re: Bin files saved as txt.. Convert
My thoughts exactly 202.... LMAO seriously when I get a chance have to look into perl!
just as a matter of interest is there a way of laying a kalmaker dif file out so it displays each section in it's own column?
LMAO... I just figured out something for myself & it was quite easy....
It's an excel DATA option called text to column & BINGO all sorted easy as!
just as a matter of interest is there a way of laying a kalmaker dif file out so it displays each section in it's own column?
LMAO... I just figured out something for myself & it was quite easy....
It's an excel DATA option called text to column & BINGO all sorted easy as!
Re: Bin files saved as txt.. Convert
Seeing as you've got perl and a bunch of those text files to convert, here's a script that will convert them for you (and pad them if needed).
Code: Select all
C:\festy>perl txt2binfile.pl "OLD VS $84 File.txt"
bin size is 49152 bytes, pad the start to 65536? (y/N)y
OLD VS $84 File.bin created
- Attachments
-
- txt2binfile.pl
- (1.34 KiB) Downloaded 224 times
-
- Posts: 2883
- Joined: Sun Aug 02, 2009 9:16 pm
- Location: Bayside, Melbourne, Victoria
- Contact:
Re: Bin files saved as txt.. Convert
YOUR A LEGEND Festy, Thanks so much thats awesome now I'll go dig perl off other HDD!
Thanks a bunch, let me know if there's anything I can do for you!
EDIT: the 2 versions of PERL i have are DZPERL58 or Strawberry PERL 5.10.0.6, are either of these any good it was years ago I got them?
Thanks a bunch, let me know if there's anything I can do for you!
EDIT: the 2 versions of PERL i have are DZPERL58 or Strawberry PERL 5.10.0.6, are either of these any good it was years ago I got them?
- antus
- Site Admin
- Posts: 8253
- Joined: Sat Feb 28, 2009 8:34 pm
- cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B - Contact:
Re: Bin files saved as txt.. Convert
Yeah for perl on windows generally its good to use the latest strawberry perl. (though if that script doesnt run on it because its too new, use the older version you have).
http://strawberryperl.com/
http://strawberryperl.com/
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396