Re: Text file types
Re: Text file types
- Subject: Re: Text file types
- From: Christopher Holland <email@hidden>
- Date: Wed, 05 Feb 2003 09:54:59 -0600
On Wednesday, February 5, 2003, at 06:12 AM, Angela Brett wrote:
...
My other question is, is there a method (perhaps something like
NSImage's - imageFileTypes) which I can use to determine whether a
file is likely to be some sort of text file? I don't mean just
checking for files with the .txt or .text extensions, I want to
include other text files such as html and C.
...
I put this answer out here just because it may be useful for someone
else when searching at a later date.
This is not the answer you're looking for, I presume, because it is not
Cocoa, but you could use the Unix command "file" on the files that you
are curious about. If a file has textual data then it should print with
the word "text" in it (per the man page for file).
BTW, a perl script would have probably been an easier way to do what
you wanted. Of course, if you are like me you probably were writing the
program more for the experience or challenge than the purpose of
actually getting something done. :)
perl -pi -e 's/<originalText>/<newText>/g' <filelist>
Christopher Holland
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.