MACSCRPT Archives

April 2008

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
jeff donovan <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 15 Apr 2008 12:01:37 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (58 lines)
greetings

my script ing is a little rusty.

i am trying to read one file and compare the two with a text output of  
my matches. -- make any sence ?

file 1 has one string of numbers

12345
12346
12347
12348

file 2 has numbers and letters

12345	apple
12346	fruit
12347	beef
12348	mustbelunchtime



I can run a simple shell grep on a terminal to find the  letters that  
correspond to the number

example:
grep 12345 file1 >> /path/tomyfile

i thought i would  get cute and simplify this process by using  
applescript but my syntax is not correct,

set IDlist to every paragraph of (read (choose file))
repeat with aID in IDlist
	try
		set ID_result to (do shell script "grep " & aID & " /Users/drfoo/ 
Desktop/filewithletters")
		if ID_result is not "" then
			set the_file1 to ("FOOHD:Users:drfoo:scripts:HERE:" as Unicode  
text) & "Checkit"
			set fRef to (open for access file the_file1 with write permission)
			try
				get eof of fRef
				write return & ID_result to fRef starting at eof
				write return
			end try
			close access fRef
		end if
	end try
end repeat


-----------------------------------
jeff donovan                          /∆\
basd network operations    \V/
(610) 807 5571 x41             (x)
AIM  xtdonovan                   //    \\

ATOM RSS1 RSS2