• 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: tab delimited data file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tab delimited data file


  • Subject: Re: tab delimited data file
  • From: John Delacour <email@hidden>
  • Date: Wed, 25 Jun 2003 20:38:51 +0100
  • Mac-eudora-version: 6.0a23

At 1:16 pm -0500 25/6/03, Rick Norman wrote:

If you had several tab delimited data files with 1000 records in each and
one of the data fields held a particular number that may repeat several
times and you wanted to reduce the 1000 records down to just one record each
by that particular number, how would you do it. A visual sample follows.


Without resorting to writing and reading a file (which is probably the way you'll want to do it) here's a way to work with your sample.


set _done to {}
set _lineending to return -- or ascii character 10 if that's what you need
set my text item delimiters to tab
set _paras to {}
set _text to "Bob 10 July, 4
Ted 10 July, 4
Carol 09 July, 4
Alice 09 July, 4
John 09 July, 4
Jane 02 July, 4
Fred 02 July, 4
Jim 01 July, 4"
set i to 0
repeat with _line in paragraphs of _text
set _number to second text item in _line as number
if _done does not contain _number then
set end of _paras to _line as Unicode text
set end of _done to _number
end if
end repeat
set my text item delimiters to _lineending
set _ecotext to _paras as Unicode text
set my text item delimiters to ""
_ecotext


JD






.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: tab delimited data file
      • From: Rick Norman <email@hidden>
References: 
 >tab delimited data file (From: Rick Norman <email@hidden>)

  • Prev by Date: RE: Projects/Instruction Suitable for an 11 yr. old?
  • Next by Date: Re: Selection in Safari
  • Previous by thread: tab delimited data file
  • Next by thread: Re: tab delimited data file
  • Index(es):
    • Date
    • Thread