From aaron at macuser.fastmail.fm Tue Sep 2 05:57:55 2008 From: aaron at macuser.fastmail.fm (Aaron) Date: Tue Sep 2 05:58:40 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? Message-ID: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> Once upon a time, like the 1970's or 80's, I probably could have written a C (or Fortran!) program to solve this problem, but my mind isn't in that space any more. I have an 80-GB file that 's an exact device copy of a drive from which I'm trying to recover some erased files. The files I'm trying to recover (AddressBook data files) are XML text files, each less than 4 KB in size and beginning with the same sequence of about 180 bytes. I split the humongous file into 160 512-MB files. Going through a few of the latter files individually with the GUI program HexEdit 2.0, I found a few of the missing AddressBook files, and confirmed my expectation that they would start on a 4-KB boundary (hex address ending in 000) in the larger files. I still remember enough csh/tcsh programming to write a script to at least separate out those of the larger files that contain one or more of the files I'm trying to recover, so as to speed up the process that I've tried already using HexEdit. That is, I could do that if I could find a command that tests a binary file for the presence of a string. It seems that such a command would surely exist, but I haven't been able to find one. (If the larger files I need to test consisted of text lines, it would probably be trivial using awk or sed.) Also, If I can figure out how to sequentially convert each 4-KB block from a large file into a separate file that can be tested (and either saved or discarded), it would make the whole process even easier. Equivalently, I would go through the large file and test at each 4-KB boundary for the presence of the desired string and, if it was found, I would copy the 4-KB chunk beginning at that point to a new file. So, the commands I'm looking for would each do one or more of the following: 1) Search a binary file for the presence of a string in the file. 2) Compare a string to the portion of a binary file beginning at a specific byte offset. (I can figure out how to compare a string to the beginning of a file!) 3) Extract a portion of a large file beginning at a specific offset and of a specific length. A special case would be to extract and process fixed-sized chunks sequentially. This isn't rocket science and, as I indicated above, once upon a time I probably could have written a C program to accomplish the task in the time it's taken me to write this message. But even then, I'd still want to know if the tools I'm referring to are out there. - Aaron From kuestner at macnews.de Tue Sep 2 06:43:00 2008 From: kuestner at macnews.de (B. Kuestner) Date: Tue Sep 2 06:46:33 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> Message-ID: <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> Try "man strings". If that doesn't solve your problem, you might want to ask the group again exactly which part you're missing, and we might find answers to these follow-up questions. Regards, Bj?rn From aaron at macuser.fastmail.fm Tue Sep 2 09:06:46 2008 From: aaron at macuser.fastmail.fm (Aaron) Date: Tue Sep 2 09:39:32 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> Message-ID: <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Thanks, Bj?rn, for your quick response. >From: "B. Kuestner" >Date: Tue, 2 Sep 2008 15:43:00 +0200 > >Try "man strings". That gets a negative result. "man string" turns up a bunch of C functions. "apropos string" turns up lots and lots of C functions and a few other useless items. Am I missing something? >If that doesn't solve your problem, you might want to ask the group >again exactly which part you're missing, and we might find answers to >these follow-up questions. > >Regards, >Bj?rn Regardless of whether I need them to solve my current problem or not, I would like to know how to do the following without programming in anything more complicated than a shell or awk or sed: 1) Search a binary file to see if it contains a certain string. 2) Read a file one (possibly arbitrary-length) block at a time and process that block before going on to the next, as one can easily do in a language like C. But, I think I'll be able to solve the problem I'm working on in other ways. One way is by doing nested splits so as to wind up with 4-KB files without having enormous numbers of such files around at any one time. I would then use 'cmp -n' to compare each 4-KB file to a smaller file containing the common start of each of the files I'm looking for. - Aaron From ecrist at secure-computing.net Tue Sep 2 09:56:30 2008 From: ecrist at secure-computing.net (Eric F Crist) Date: Tue Sep 2 10:22:18 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Message-ID: <316F7BDE-61B3-485C-BFFB-DA567ADF8C3E@secure-computing.net> you should be able to run 'strings ' where is the name of the binary file you want to search. HTH On Sep 2, 2008, at 11:06 AM, Aaron wrote: > Thanks, Bj?rn, for your quick response. > >> From: "B. Kuestner" >> Date: Tue, 2 Sep 2008 15:43:00 +0200 >> >> Try "man strings". > > That gets a negative result. "man string" turns up a bunch of C > functions. "apropos string" turns up lots and lots of C functions > and a few other useless items. Am I missing something? > >> If that doesn't solve your problem, you might want to ask the group >> again exactly which part you're missing, and we might find answers to >> these follow-up questions. >> >> Regards, >> Bj?rn > > Regardless of whether I need them to solve my current problem or > not, I would like to know how to do the following without > programming in anything more complicated than a shell or awk or sed: > > 1) Search a binary file to see if it contains a certain string. > > 2) Read a file one (possibly arbitrary-length) block at a time and > process that block before going on to the next, as one can easily do > in a language like C. > > But, I think I'll be able to solve the problem I'm working on in > other ways. One way is by doing nested splits so as to wind up with > 4-KB files without having enormous numbers of such files around at > any one time. I would then use 'cmp -n' to compare each 4-KB file to > a smaller file containing the common start of each of the files I'm > looking for. > > - Aaron > _______________________________________________ > X-Unix mailing list > X-Unix@listserver.themacintoshguy.com > http://listserver.themacintoshguy.com/mailman/listinfo/x-unix --- Eric Crist From groups at pursued-with.net Tue Sep 2 09:58:50 2008 From: groups at pursued-with.net (Kevin Stevens) Date: Tue Sep 2 10:23:13 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> Message-ID: > I still remember enough csh/tcsh programming to write a script to at least > separate out those of the larger files that contain one or more of the > files I'm trying to recover, so as to speed up the process that I've tried > already using HexEdit. That is, I could do that if I could find a command > that tests a binary file for the presence of a string. It seems that such > a command would surely exist, but I haven't been able to find one. (If the > larger files I need to test consisted of text lines, it would probably be > trivial using awk or sed.) > > Also, If I can figure out how to sequentially convert each 4-KB block from > a large file into a separate file that can be tested (and either saved or > discarded), it would make the whole process even easier. > > Equivalently, I would go through the large file and test at each 4-KB > boundary for the presence of the desired string and, if it was found, I > would copy the 4-KB chunk beginning at that point to a new file. > > So, the commands I'm looking for would each do one or more of the > following: > > 1) Search a binary file for the presence of a string in the file. > > 2) Compare a string to the portion of a binary file beginning at a > specific byte offset. (I can figure out how to compare a string to the > beginning of a file!) > > 3) Extract a portion of a large file beginning at a specific offset and of > a specific length. A special case would be to extract and process > fixed-sized chunks sequentially. > > This isn't rocket science and, as I indicated above, once upon a time I > probably could have written a C program to accomplish the task in the time > it's taken me to write this message. But even then, I'd still want to > know if the tools I'm referring to are out there. > > - Aaron grep strings split KeS From dledger at ivdcs.demon.co.uk Tue Sep 2 11:18:15 2008 From: dledger at ivdcs.demon.co.uk (David Ledger) Date: Tue Sep 2 12:18:46 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Message-ID: At 09:06 -0700 2/9/08, Aaron wrote: >Thanks, Bj?rn, for your quick response. > >>From: "B. Kuestner" >>Date: Tue, 2 Sep 2008 15:43:00 +0200 >> >>Try "man strings". > >That gets a negative result. "man string" turns up a bunch of C >functions. "apropos string" turns up lots and lots of C functions >and a few other useless items. Am I missing something? My Leopard is also missing a man page for 'strings'. For other versions of strings strings -a file searches the entire binary. If it thinks it's an app, only the data segment is searched. strings -t x file shows the offset where the string is found. 'x' can be 'd' for decimal, 'o' for octal, 'x' for hex. Searching with perl is another possibility. David -- David Ledger - Freelance Unix Sysadmin in the UK. HP-UX specialist of hpUG technical user group (www.hpug.org.uk) david.ledger@ivdcs.co.uk www.ivdcs.co.uk From groups at pursued-with.net Tue Sep 2 12:53:09 2008 From: groups at pursued-with.net (Kevin Stevens) Date: Tue Sep 2 12:56:30 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Message-ID: On Tue, 2 Sep 2008, David Ledger wrote: > At 09:06 -0700 2/9/08, Aaron wrote: >>> Try "man strings". >> >> That gets a negative result. "man string" turns up a bunch of C >> functions. "apropos string" turns up lots and lots of C functions and a >> few other useless items. Am I missing something? > > My Leopard is also missing a man page for 'strings'. For other versions > of strings > strings -a file searches the entire binary. If it thinks it's an app, > only the data segment is searched. > strings -t x file shows the offset where the string is found. 'x' can > be 'd' for decimal, 'o' for octal, 'x' for hex. > > Searching with perl is another possibility. > > David Hmm, my 10.5.4 box has the man page, dated 2006. It was an upgrade from 10.4, I wonder if I inherited it from there, or maybe from the developer toolkit? KeS From ecrist at secure-computing.net Tue Sep 2 13:37:58 2008 From: ecrist at secure-computing.net (Eric F Crist) Date: Tue Sep 2 13:41:45 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com><1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de><20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Message-ID: <1675086550-1220388064-cardhu_decombobulator_blackberry.rim.net-1095847558-@bxe279.bisx.prod.on.blackberry> Dev toolkit. --- Eric F Crist Secure Computing Networks -----Original Message----- From: Kevin Stevens Date: Tue, 2 Sep 2008 12:53:09 To: A place to discuss Mac OS X from the perspective of the command line. Subject: Re: [X-Unix] How does one find a string in a binary file, etc.? On Tue, 2 Sep 2008, David Ledger wrote: > At 09:06 -0700 2/9/08, Aaron wrote: >>> Try "man strings". >> >> That gets a negative result. "man string" turns up a bunch of C >> functions. "apropos string" turns up lots and lots of C functions and a >> few other useless items. Am I missing something? > > My Leopard is also missing a man page for 'strings'. For other versions > of strings > strings -a file searches the entire binary. If it thinks it's an app, > only the data segment is searched. > strings -t x file shows the offset where the string is found. 'x' can > be 'd' for decimal, 'o' for octal, 'x' for hex. > > Searching with perl is another possibility. > > David Hmm, my 10.5.4 box has the man page, dated 2006. It was an upgrade from 10.4, I wonder if I inherited it from there, or maybe from the developer toolkit? KeS _______________________________________________ X-Unix mailing list X-Unix@listserver.themacintoshguy.com http://listserver.themacintoshguy.com/mailman/listinfo/x-unix From dledger at ivdcs.demon.co.uk Tue Sep 2 13:46:54 2008 From: dledger at ivdcs.demon.co.uk (David Ledger) Date: Tue Sep 2 14:18:10 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Message-ID: At 12:53 -0700 2/9/08, Kevin Stevens wrote: >On Tue, 2 Sep 2008, David Ledger wrote: > >> At 09:06 -0700 2/9/08, Aaron wrote: >>>> Try "man strings". >>> That gets a negative result. "man string" turns up a bunch of C >>>functions. "apropos string" turns up lots and lots of C functions >>>and a few other useless items. Am I missing something? >> >> My Leopard is also missing a man page for 'strings'. For other >>versions of strings > >Hmm, my 10.5.4 box has the man page, dated 2006. It was an upgrade >from 10.4, I wonder if I inherited it from there, or maybe from the >developer toolkit? > >KeS Odd. My Leopard mini, that was installed with a fresh install when nearly new, has it, but my Panther-Tiger-Leopard Updated 17"PB doesn't. Both have the Dev Toolkit installed. Oh-well... David -- David Ledger - Freelance Unix Sysadmin in the UK. HP-UX specialist of hpUG technical user group (www.hpug.org.uk) david.ledger@ivdcs.co.uk www.ivdcs.co.uk From Peter_Dyballa at Web.DE Tue Sep 2 14:51:37 2008 From: Peter_Dyballa at Web.DE (Peter Dyballa) Date: Tue Sep 2 14:53:19 2008 Subject: [X-Unix] Re: How does one find a string in a binary file, etc.? In-Reply-To: <20080902125903.3246E3C8B55B@listserver.themacintoshguy.com> References: <20080902125903.3246E3C8B55B@listserver.themacintoshguy.com> Message-ID: Am 02.09.2008 um 14:59 schrieb Aaron: > Also, If I can figure out how to sequentially convert each 4-KB > block from a large file into a separate file that can be tested > (and either saved or discarded), it would make the whole process > even easier. > > Equivalently, I would go through the large file and test at each 4- > KB boundary for the presence of the desired string and, if it was > found, I would copy the 4-KB chunk beginning at that point to a new > file. The commands strings and grep can determine whether a large file has a hit. The commands split (or csplit?) can produce small files of exactly 4 KB size from the interesting large one. If the (small or large) file has no hit, remove it. -- Greetings Pete Make it simple, as simple as possible but no simpler. ? Albert Einstein From ecrist at secure-computing.net Tue Sep 2 15:05:40 2008 From: ecrist at secure-computing.net (Eric F Crist) Date: Tue Sep 2 15:07:28 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Message-ID: From my Tiger -> Leopard MBP 15 from 2006 (w/Dev Toolkit): foobeans@beans:~/> man strings STRINGS (1 ) STRINGS (1) NAME strings - find the printable strings in a object, or other binary, file SYNOPSIS strings [ - ] [ -a ] [ -o ] [ -t format ] [ -number ] [ -n number ] [--] [file ...] DESCRIPTION Strings looks for ASCII strings in a binary file or standard input. Strings is useful for identify- ing random object files and many other things. A string is any sequence of 4 (the default) or more printing characters ending with a newline or a null. Unless the - flag is given, strings looks in all sections of the object files except the (__TEXT,__text) section. If no files are specified stan- dard input is read. On Sep 2, 2008, at 3:46 PM, David Ledger wrote: > At 12:53 -0700 2/9/08, Kevin Stevens wrote: >> On Tue, 2 Sep 2008, David Ledger wrote: >> >>> At 09:06 -0700 2/9/08, Aaron wrote: >>>>> Try "man strings". >>>> That gets a negative result. "man string" turns up a bunch of C >>>> functions. "apropos string" turns up lots and lots of C functions >>>> and a few other useless items. Am I missing something? >>> >>> My Leopard is also missing a man page for 'strings'. For other >>> versions of strings >> >> Hmm, my 10.5.4 box has the man page, dated 2006. It was an upgrade >> from 10.4, I wonder if I inherited it from there, or maybe from the >> developer toolkit? >> >> KeS > > Odd. My Leopard mini, that was installed with a fresh install when > nearly new, has it, but my Panther-Tiger-Leopard Updated 17"PB > doesn't. Both have the Dev Toolkit installed. > Oh-well... > > David > > -- > David Ledger - Freelance Unix Sysadmin in the UK. > HP-UX specialist of hpUG technical user group (www.hpug.org.uk) > david.ledger@ivdcs.co.uk > www.ivdcs.co.uk > _______________________________________________ > X-Unix mailing list > X-Unix@listserver.themacintoshguy.com > http://listserver.themacintoshguy.com/mailman/listinfo/x-unix --- Eric Crist From baltwo at san.rr.com Tue Sep 2 15:17:45 2008 From: baltwo at san.rr.com (John Baltutis) Date: Tue Sep 2 15:22:49 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: <20080902215356.760B93CAA206@listserver.themacintoshguy.com> References: <20080902215356.760B93CAA206@listserver.themacintoshguy.com> Message-ID: On 9/2/08, David Ledger wrote: >>>From: "B. Kuestner" >>>Try "man strings". >> >>That gets a negative result. "man string" turns up a bunch of C >>functions. "apropos string" turns up lots and lots of C functions >>and a few other useless items. Am I missing something? > > My Leopard is also missing a man page for 'strings'. Then, you have a hosed installation. On my 10.5.4 installation, man strings returns: "STRINGS(1) STRINGS(1) NAME strings - find the printable strings in a object, or other binary, file SYNOPSIS strings [ - ] [ -a ] [ -o ] [ -t format ] [ -number ] [ -n number ] [--] [file ...] DESCRIPTION Strings looks for ASCII strings in a binary file or standard input. Strings is useful for identifying random object files and many other things. A string is any sequence of 4 (the default) or more printing characters ending with a newline or a null. Unless the - flag is given, strings looks in all sections of the object files except the (__TEXT,__text) section. If no files are specified standard input is read. etc." From groups at pursued-with.net Tue Sep 2 19:23:11 2008 From: groups at pursued-with.net (Kevin Stevens) Date: Tue Sep 2 19:24:15 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Message-ID: <0ADF7B7A-C6C8-4D4F-AC5D-CC812D13BF56@pursued-with.net> On Sep 2, 2008, at 09:06, Aaron wrote: > Thanks, Bj?rn, for your quick response. > >> From: "B. Kuestner" >> Date: Tue, 2 Sep 2008 15:43:00 +0200 >> >> Try "man strings". > > That gets a negative result. "man string" turns up a bunch of C > functions. "apropos string" turns up lots and lots of C functions > and a few other useless items. Am I missing something? You're missing an "s" on the end of "string"... KeS From magill at mcgillsociety.org Wed Sep 3 09:02:20 2008 From: magill at mcgillsociety.org (William H. Magill) Date: Wed Sep 3 09:15:03 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> Message-ID: <688333EA-3F83-41A1-B2C3-E6692911D623@mcgillsociety.org> On Sep 2, 2008, at 4:46 PM, David Ledger wrote: > At 12:53 -0700 2/9/08, Kevin Stevens wrote: >> On Tue, 2 Sep 2008, David Ledger wrote: >> >>> At 09:06 -0700 2/9/08, Aaron wrote: >>>>> Try "man strings". >>>> That gets a negative result. "man string" turns up a bunch of C >>>> functions. "apropos string" turns up lots and lots of C functions >>>> and a few other useless items. Am I missing something? >>> >>> My Leopard is also missing a man page for 'strings'. For other >>> versions of strings >> >> Hmm, my 10.5.4 box has the man page, dated 2006. It was an upgrade >> from 10.4, I wonder if I inherited it from there, or maybe from the >> developer toolkit? >> >> KeS > > Odd. My Leopard mini, that was installed with a fresh install when > nearly new, has it, but my Panther-Tiger-Leopard Updated 17"PB > doesn't. Both have the Dev Toolkit installed. > Oh-well.. As I recall, there was some issue with man pages when you upgraded from Tiger to Leopard, in particular. I don't recall the details, but I know that my 10.5.4 system, which I recently did an archive/install followed about a week later by a bare- metal recovery from Time Machine (both because of a disk problem) does have the man page for strings. It also had "different" icons show up for some system apps after the Time Machine reload. The reload went without a problem. Booted from the Install DVD and then reloaded from its menu. Quite a pleasant operation compared with the number of bare-metal installs/reloads I've done in 30 years as a Unix sys-admin using all kinds of "professional" backup software like Veritas and others. T.T.F.N. William H. Magill # Beige G3 [Rev A motherboard - 300 MHz 768 Meg] OS X 10.2.8 # Flat-panel iMac (2.1) [800MHz - Super Drive - 768 Meg] OS X 10.4.11 # iMac6,1 Core 2 Duo [2.16GHz - 3 GB 667] OS X 10.5.4 # Mac mini Core Duo [1.66 Ghz - 2 GB 667]OS X 10.5.4 # PWS433a [Alpha 21164 Rev 7.2 (EV56)- 64 Meg] Tru64 5.1a # XP1000 [Alpha 21264-3 (EV6) - 256 meg] FreeBSD 5.3 # XP1000 [Alpha 21264-A (EV 6.7) - 384 meg] FreeBSD 5.3 magill@mcgillsociety.org magill@mac.com whmagill@gmail.com From kuestner at macnews.de Wed Sep 3 13:16:39 2008 From: kuestner at macnews.de (B. Kuestner) Date: Wed Sep 3 13:17:35 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? => Leopard man pages In-Reply-To: <688333EA-3F83-41A1-B2C3-E6692911D623@mcgillsociety.org> References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> <688333EA-3F83-41A1-B2C3-E6692911D623@mcgillsociety.org> Message-ID: <88C079B3-9184-452A-A8ED-5157C78E4F89@macnews.de> > As I recall, there was some issue with man pages when you upgraded > from Tiger to Leopard, in particular. You might be referring to this one? Bj?rn From aaron at macuser.fastmail.fm Thu Sep 4 16:51:21 2008 From: aaron at macuser.fastmail.fm (Aaron) Date: Thu Sep 4 16:55:31 2008 Subject: [X-Unix] Urgent question about accidentally deleted files Message-ID: <20080904235127.952799D0F@heartbeat1.messagingengine.com> In the course of testing a shell script, I accidentally deleted all of the following files from my home directory: .CFUserTextEncoding .DS_Store .Xauthority .bash_history .cshrc .eno .fonts.cache-1 .gdb_history .gtk-bookmarks .lesshst .login .prismPrefs .profile .rnd .tcshrc .viminfo 1) Which of these files can I totally ignore without losing anything? (I don't use bash or gdb. I do use tcsh. But if I need to run a bash script, will there be any problems.) 2) Which ones can be replaced using earlier versions? I'm presuming that .tcshrc and .login can, even if the earlier versions are from my Tiger startup. (I'm using Leopard now.) 3) Any other considerations? (Don't tell me about backing up. I'm getting set up to use time machine, but i don't even know if that would let me only recover specific files without replacing other new files.) - TIA - Aaron From ecrist at secure-computing.net Thu Sep 4 17:23:50 2008 From: ecrist at secure-computing.net (Eric F Crist) Date: Thu Sep 4 17:27:37 2008 Subject: [X-Unix] Urgent question about accidentally deleted files In-Reply-To: <20080904235127.952799D0F@heartbeat1.messagingengine.com> References: <20080904235127.952799D0F@heartbeat1.messagingengine.com> Message-ID: <1254155368-1220574418-cardhu_decombobulator_blackberry.rim.net-333604752-@bxe279.bisx.prod.on.blackberry> You can ignore them all. They will be recreated as needed. --- Eric F Crist Secure Computing Networks -----Original Message----- From: Aaron Date: Thu, 4 Sep 2008 16:51:21 To: Subject: [X-Unix] Urgent question about accidentally deleted files In the course of testing a shell script, I accidentally deleted all of the following files from my home directory: ..CFUserTextEncoding .DS_Store .Xauthority .bash_history .cshrc .eno .fonts.cache-1 .gdb_history .gtk-bookmarks .lesshst .login .prismPrefs .profile .rnd .tcshrc .viminfo 1) Which of these files can I totally ignore without losing anything? (I don't use bash or gdb. I do use tcsh. But if I need to run a bash script, will there be any problems.) 2) Which ones can be replaced using earlier versions? I'm presuming that .tcshrc and .login can, even if the earlier versions are from my Tiger startup. (I'm using Leopard now.) 3) Any other considerations? (Don't tell me about backing up. I'm getting set up to use time machine, but i don't even know if that would let me only recover specific files without replacing other new files.) - TIA - Aaron _______________________________________________ X-Unix mailing list X-Unix@listserver.themacintoshguy.com http://listserver.themacintoshguy.com/mailman/listinfo/x-unix From groups at pursued-with.net Thu Sep 4 17:35:04 2008 From: groups at pursued-with.net (Kevin Stevens) Date: Thu Sep 4 17:35:47 2008 Subject: [X-Unix] Urgent question about accidentally deleted files In-Reply-To: <20080904235127.952799D0F@heartbeat1.messagingengine.com> References: <20080904235127.952799D0F@heartbeat1.messagingengine.com> Message-ID: <83C68C23-5621-45DC-9C7F-4C04D8AFDA42@pursued-with.net> On Sep 4, 2008, at 16:51, Aaron wrote: > In the course of testing a shell script, I accidentally deleted all > of the following files from my home directory: > > .CFUserTextEncoding > .DS_Store > .Xauthority > .bash_history > .cshrc > .eno > .fonts.cache-1 > .gdb_history > .gtk-bookmarks > .lesshst > .login > .prismPrefs > .profile > .rnd > .tcshrc > .viminfo > > 1) Which of these files can I totally ignore without losing > anything? (I don't use bash or gdb. I do use tcsh. But if I need to > run a bash script, will there be any problems.) > > 2) Which ones can be replaced using earlier versions? I'm presuming > that .tcshrc and .login can, even if the earlier versions are from > my Tiger startup. (I'm using Leopard now.) > > 3) Any other considerations? (Don't tell me about backing up. I'm > getting set up to use time machine, but i don't even know if that > would let me only recover specific files without replacing other new > files.) > > - TIA > - Aaron .login and .profile control your user startup experience. You might want to create a new user and copy those files from their user directory. Otherwise you should be ok. KeS From aaron at macuser.fastmail.fm Fri Sep 5 04:00:32 2008 From: aaron at macuser.fastmail.fm (Aaron) Date: Fri Sep 5 04:09:19 2008 Subject: [X-Unix] Urgent question about accidentally deleted files In-Reply-To: <1254155368-1220574418-cardhu_decombobulator_blackberry.rim.ne t-333604752-@bxe279.bisx.prod.on.blackberry> References: <20080904235127.952799D0F@heartbeat1.messagingengine.com> <1254155368-1220574418-cardhu_decombobulator_blackberry.rim.ne t-333604752-@bxe279.bisx.prod.on.blackberry> Message-ID: <20080905110038.2D01813DE5@heartbeat1.messagingengine.com> >From: "Eric F Crist" >Date: Fri, 5 Sep 2008 00:23:50 +0000 > >You can ignore them all. They will be recreated as needed. After my initial panic wore off, I decided to copy .login and .tcshrc from my old Tiger home directory (on another disk), since I didn't want to have to re-create all my aliases, etc. Also, I figured that anything in the Tiger home directory that wouldn't clobber anything in my Leopard home directory was safe to copy, although probably useless. - Aaron P.S. It's not only hard to teach an old dog NEW tricks. This old dog is struggling to relearn OLD tricks that he gradually forgot after being seduced about 20 years ago by the Macintosh GUI. >--- >Eric F Crist >Secure Computing Networks > >-----Original Message----- >From: Aaron > >Date: Thu, 4 Sep 2008 16:51:21 >To: >Subject: [X-Unix] Urgent question about accidentally deleted files > > >In the course of testing a shell script, I accidentally deleted all of the following files from my home directory: > >..CFUserTextEncoding >.DS_Store >.Xauthority >.bash_history >.cshrc >.eno >.fonts.cache-1 >.gdb_history >.gtk-bookmarks >.lesshst >.login >.prismPrefs >.profile >.rnd >.tcshrc >.viminfo > >1) Which of these files can I totally ignore without losing anything? (I don't use bash or gdb. I do use tcsh. But if I need to run a bash script, will there be any problems.) > >2) Which ones can be replaced using earlier versions? I'm presuming that .tcshrc and .login can, even if the earlier versions are from my Tiger startup. (I'm using Leopard now.) > >3) Any other considerations? (Don't tell me about backing up. I'm getting set up to use time machine, but i don't even know if that would let me only recover specific files without replacing other new files.) > > - TIA > - Aaron From aaron at macuser.fastmail.fm Fri Sep 5 04:15:09 2008 From: aaron at macuser.fastmail.fm (Aaron) Date: Fri Sep 5 04:24:06 2008 Subject: [X-Unix] How does one find a string in a binary file, etc.? In-Reply-To: <0ADF7B7A-C6C8-4D4F-AC5D-CC812D13BF56@pursued-with.net> References: <20080902125759.724F0AC17@heartbeat1.messagingengine.com> <1F0CAB97-3953-4576-A498-0A98E0F44D31@macnews.de> <20080902160700.8B8C220A7E@heartbeat2.messagingengine.com> <0ADF7B7A-C6C8-4D4F-AC5D-CC812D13BF56@pursued-with.net> Message-ID: <20080905111529.7DA9513DE7@heartbeat1.messagingengine.com> >From: Kevin Stevens >Date: Tue, 2 Sep 2008 19:23:11 -0700 > >On Sep 2, 2008, at 09:06, Aaron wrote: > >> Thanks, Bj?rn, for your quick response. >> >>> From: "B. Kuestner" >>> Date: Tue, 2 Sep 2008 15:43:00 +0200 >>> > >> Try "man strings". >> > > That gets a negative result. "man string" turns up a bunch of C >> functions. "apropos string" turns up lots and lots of C functions >> and a few other useless items. Am I missing something? > >You're missing an "s" on the end of "string"... I had, as I meant to make clear, tried both "man string" and "man strings". But it turns out that what I was missing was XcodeTools. I hadn't installed it on my Leopard (10.5.4) startup volume that I just started using a couple of weeks ago. (Previously I had been using Tiger with Xcode 2.4 or 2.5.) I downloaded Xcode 3.0, did a standard install and, voila!, "man strings" works! While I can imagine writing a script using "strings", it seems rather an awkward approach, since it finds all text strings in the file at all locations. I'm working now on a script to (1) split the 512-MB files one at a time into 1-MB files; (2) split the 1-MB files one at a time into 4-KB files; and (3) test each 4-KB file, saving the ones that match the desired pattern. It requires that I relearn a lot of csh/tcsh syntax details that I knew like the back of my hand 20 years ago. (I know that most people prefer other shells, but I'm going with the one I've used a lot in the past. If I were going to put the time into learning another shell, I'd rather learn Perl or Tcl/Tk instead.) Also, in order to avoid more accidents like the one I described in "[X-Unix] Urgent question about accidentally deleted files", I'm going to move around the files for testing this script so I can do the whole thing from a new, temporary user account. - Aaron From aaron at macuser.fastmail.fm Fri Sep 5 05:37:40 2008 From: aaron at macuser.fastmail.fm (Aaron) Date: Fri Sep 5 05:48:09 2008 Subject: [X-Unix] Bad behavior of 'head', etc., in reading pipes. Message-ID: <20080905123747.AEF1D35B59@heartbeat2.messagingengine.com> The following observation has been verified by me only with tcsh, so I'd be curious to know if it occurs with other shells. I executed a number of variants of the command line: cat input_file | ( head -c NUM1 >! testfile; head -c NUM2 ) In each case, instead of the output of the second 'head' beginning right after where the first 'head' left off, it always begins at the next offset (from the start of input_file) that's a multiple of 16KB. Variants tested include reading a number of lines rather than characters and using the command 'od' in place of 'head'. But with the command line: ( head -c NUM1 >! testfile; head -c NUM2 ) < input_file a similar thing happens, except that the offset for the second read is the next multiple of 4KB, not 16KB. Is this a problem with the way 'head' and 'od' read from the standard input, or is it a limitation of the way pipes and redirects are implemented, at least when created by tcsh? From jerry at ieee.org Sun Sep 7 17:33:59 2008 From: jerry at ieee.org (Jerry Krinock) Date: Sun Sep 7 17:34:54 2008 Subject: [X-Unix] diff Binary Files and get List of Differences Message-ID: <3125F368-1907-4D9B-8614-345E1405D822@ieee.org> If two binary files aaa and bbb are different, jk$ diff aaa bbb Binary files aaa and bbb differ True, but I would like to see a list of the differences, like diff gives me for text files. I understand that this is problematic with binary files since they're one big line, but if, say, the file sizes were the same and the bytes were aligned but some were just different values, I'd like a list of address offsets that differ. The man page doesn't seem to explicitly mention this limitation. Is it true that "differ" is the only info you get when you diff binary files? Does anyone have a favorite tool that would do what I want? Thanks, Jerry Krinock From jakobsen.lasse at euro.apple.com Sun Sep 7 17:41:58 2008 From: jakobsen.lasse at euro.apple.com (Lasse) Date: Sun Sep 7 17:43:39 2008 Subject: [X-Unix] diff Binary Files and get List of Differences In-Reply-To: <3125F368-1907-4D9B-8614-345E1405D822@ieee.org> References: <3125F368-1907-4D9B-8614-345E1405D822@ieee.org> Message-ID: diff -a aaa bbb will treat any files as text files and list the differences... /L Den 08/09/2008 kl. 01.33 skrev Jerry Krinock: > If two binary files aaa and bbb are different, > > jk$ diff aaa bbb > Binary files aaa and bbb differ > > True, but I would like to see a list of the differences, like diff > gives me for text files. I understand that this is problematic with > binary files since they're one big line, but if, say, the file sizes > were the same and the bytes were aligned but some were just > different values, I'd like a list of address offsets that differ. > > The man page doesn't seem to explicitly mention this limitation. > > Is it true that "differ" is the only info you get when you diff > binary files? > > Does anyone have a favorite tool that would do what I want? > > Thanks, > > Jerry Krinock > _______________________________________________ > X-Unix mailing list > X-Unix@listserver.themacintoshguy.com > http://listserver.themacintoshguy.com/mailman/listinfo/x-unix From macmonster at myrealbox.com Mon Sep 8 01:36:44 2008 From: macmonster at myrealbox.com (Stroller) Date: Mon Sep 8 01:37:40 2008 Subject: [X-Unix] diff Binary Files and get List of Differences In-Reply-To: <3125F368-1907-4D9B-8614-345E1405D822@ieee.org> References: <3125F368-1907-4D9B-8614-345E1405D822@ieee.org> Message-ID: On 8 Sep 2008, at 01:33, Jerry Krinock wrote: > If two binary files aaa and bbb are different, > > jk$ diff aaa bbb > Binary files aaa and bbb differ > > True, but I would like to see a list of the differences, like diff > gives me for text files. I understand that this is problematic > with binary files since they're one big line, but if, say, the file > sizes were the same and the bytes were aligned but some were just > different values, I'd like a list of address offsets that differ. Hi there, `hexdump -C aaa` and diff that with the hexdump of bbb? Stroller. From magill at mcgillsociety.org Sat Sep 20 12:02:37 2008 From: magill at mcgillsociety.org (William H. Magill) Date: Sat Sep 20 12:04:27 2008 Subject: [X-Unix] debugging /etc/syslogd.conf under Leopard In-Reply-To: <20080904235127.952799D0F@heartbeat1.messagingengine.com> References: <20080904235127.952799D0F@heartbeat1.messagingengine.com> Message-ID: <77A46311-397B-4C7E-B112-61BC623AC253@mcgillsociety.org> In the "good old days," (of Unix and OS X) one could simply kill off syslogd, and restart it as "syslogd -d". It would hang around nicely on your terminal and tell you what was wrong with your conf file. That technique no longer works. Nor does adding the -d flag to the .plist file. It (launchd) apparently runs syslogd with the -d flag, but no output appears anywhere that I can find. Without launchd, syslogd generates an error if you try to run "/usr/ sbin/syslogd -d" directly from the terminal. So the basic question is ... does syslogd still provide the "syntax/ error checking which the man page claims it does? T.T.F.N. William H. Magill # Beige G3 [Rev A motherboard - 300 MHz 768 Meg] OS X 10.2.8 # Flat-panel iMac (2.1) [800MHz - Super Drive - 768 Meg] OS X 10.4.11 # iMac6,1 Core 2 Duo [2.16GHz - 3 GB 667] OS X 10.5.5 # Mac mini Core Duo [1.66 Ghz - 2 GB 667]OS X 10.5.5 # PWS433a [Alpha 21164 Rev 7.2 (EV56)- 64 Meg] Tru64 5.1a # XP1000 [Alpha 21264-3 (EV6) - 256 meg] FreeBSD 5.3 # XP1000 [Alpha 21264-A (EV 6.7) - 384 meg] FreeBSD 5.3 magill@mcgillsociety.org magill@mac.com whmagill@gmail.com From ecrist at secure-computing.net Sat Sep 20 14:15:43 2008 From: ecrist at secure-computing.net (Eric F Crist) Date: Sat Sep 20 14:18:17 2008 Subject: [X-Unix] debugging /etc/syslogd.conf under Leopard In-Reply-To: <77A46311-397B-4C7E-B112-61BC623AC253@mcgillsociety.org> References: <20080904235127.952799D0F@heartbeat1.messagingengine.com> <77A46311-397B-4C7E-B112-61BC623AC253@mcgillsociety.org> Message-ID: <79D956F5-C98F-4E90-923D-DA4617EEAA7F@secure-computing.net> On Sep 20, 2008, at 2:02 PM, William H. Magill wrote: > In the "good old days," (of Unix and OS X) one could simply kill off > syslogd, and restart it as "syslogd -d". > It would hang around nicely on your terminal and tell you what was > wrong with your conf file. > > That technique no longer works. Nor does adding the -d flag to > the .plist file. > > It (launchd) apparently runs syslogd with the -d flag, but no output > appears anywhere that I can find. > > Without launchd, syslogd generates an error if you try to run "/usr/ > sbin/syslogd -d" directly from the terminal. > > So the basic question is ... does syslogd still provide the "syntax/ > error checking which the man page claims it does? 1) man launchd 2) man launchctl HTH --- Eric Crist