| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| There are other useful commands which can come to the rescue (echo command used just to generate test data): 1) To remove all spaces at the beginning of the string echo -e " aaa aaa\nbbb bbb\n ccc ccc" | sed -e "1,\$s/^[ ]*//" 2) To "normalize" spaces (many to one ) echo -e " aaa aaa\nbbb bbb\n ccc ccc" | sed -e "1,\$s/^[ ]*//" | sed -e "1,\$s/ [ ]*/ /g" 3) To select 1st colum echo -e " aaa aaa\nbbb bbb\n ccc ccc" | sed -e "1,\$s/^[ ]*//" | sed -e "1,\$s/ [ ]*/ /g" | cut "-d\ " -f1 4) Optionally, if you need to remove duplicates ... | sort -u NOTE: If your want to compare data as numbers, use "sort -n -u". On Mar 28, 2007, at 11:53 AM, Richard Rönnbäck wrote:
|
_______________________________________________ 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/archives/applescript-users This email sent to email@hidden
| References: | |
| >Shell grep help - how to get only first occurrence of match? (From: Richard Rönnbäck <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.