• 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: Doug McNutt <email@hidden>
  • Date: Thu, 26 Jun 2003 09:27:26 -0600

#!/usr/bin/perl
#
%used = (); # define a blank hash
open INPUT, $ARGV[0] or die "Can't open source file.\n";
# $/ = "\r"; # Uncomment this line for Mac line endings in the data file
while (<INPUT>)
{
@fields = split /\t/;
if (exists $used{$fields[1]} )
{
$used{$fields[1]} += 1; # count just for the fun of it
}
else
{
$used{$fields[1]} = 1; # a new find
print $_; # so print the line as read.
}
}
__END__

Sample command lines:
perl -w tabs.pl clipmac.tsv
perl -w tabs.pl clipmac.tsv > $output # to create a file by name
tabs.pl clipmac.tsv # if the execute bit is set for the source file.

I'll leave it to others to encapsulate it into an AppleScript with "quoted form".

The perl source needs to have Unix line ends. BBEdit is the way I do it.


--

Applescript syntax is like English spelling:
Roughly, but not thoroughly, thought through.
_______________________________________________
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.

References: 
 >tab delimited data file (From: Rick Norman <email@hidden>)

  • Prev by Date: Re: tab delimited data file
  • Next by Date: Re: Eudora pause
  • Previous by thread: Re: tab delimited data file
  • Next by thread: Re: tab delimited data file
  • Index(es):
    • Date
    • Thread