• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Text file types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Text file types (From: Angela Brett <email@hidden>)

  • Prev by Date: Re: Welcome To Macintosh Startup Screen (first-launch)
  • Next by Date: Re: Missing inactive and disabled states on some controls
  • Previous by thread: Re: Text file types
  • Next by thread: link between classes using a class variable
  • Index(es):
    • Date
    • Thread