Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Merge all names into 1 file



Based on the stuff you attached, your files are using Mac OS <= 9
newline conventions - bare carriage returns, no linefeeds.  So the
UNIX commands see each of them as consisting of one giant line, and
since they do the comparisons on a line-by-line basis, they wind up
not doing anything at all.


Try this. Instead of

                        sort -u file1 file2 file3 ...

do

                          cat file1 file2 file3 ... | tr '\015'
'\012' | sort -u

and see if that works better for you.


On 11/6/06, Jan Bultereys <email@hidden> wrote:
Hi mark, This looked a very simple solution and fast also, but the output
still generates doubles...

This is what I have:
set a to
"BELMAC19X:Users:jbultere:Desktop:All_images:compiled:all_images_belflow"
set b to
"BELMAC19X:Users:jbultere:Desktop:All_images:compiled:all_images_deuflow"
set comp to
"BELMAC19X:Users:jbultere:Desktop:All_images:compiled:all_images_compiled"
tell application "Finder"
    do shell script "sort -u " & (quoted form of POSIX path of a) & " " &
(quoted form of POSIX path of b) & ">" & (quoted form of POSIX path of comp)
end tell

Please look at result: (example)
 3M RD
UK_99993_MG21WAREHOUSE1

Are still double....

Maybe it's because they are pretty big?

Many thanks,
Jan



> From: "Mark J. Reed" <email@hidden>
> Date: Mon, 6 Nov 2006 09:37:35 -0500
> To: Jan Bultereys <email@hidden>
> Cc: "email@hidden" <email@hidden>
> Subject: Re: Merge all names into 1 file
>
> On 11/6/06, Jan Bultereys <email@hidden> wrote:
>>  I have 7 text files
>>  ....
>>
>>  Is it possible to merge the 7 files into ONE where all the "duplicated"
>> names are merged into one.
>
> Sure.
>
> do shell script "sort -u " & (quoted form of POSIX path of file1) & "
> " & (quoted form of POSIX path of file2) & " "  & ... & " " & (quoted
> form of POSIX path of file7) & ">" & (quoted form of POSIX path of
> resultFile)
>
> if you have the filenames in a list you can of course build the
> command string up with a loop, which would be less unwieldy (more
> wieldy?). If you really want 'all the files in this folder' then that
> would be a better way to approach it, too.  The important thing is
> that you wind up with a shell command that consists of "sort -u "
> followed by the quoted POSIX paths of all the files, separated by
> spaces, followed by ">" and the quoted POSIX path of the file you want
> the sorted uniquified results to go into.
>
>
>
> --
> Mark J. Reed <email@hidden>






--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >Re: Merge all names into 1 file (From: "Mark J. Reed" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.