Posted on 01-31-2014 01:56 PM
I am attempting to make a script that will sync Illustrator custom dictionaries. The user will run this via Self Service when they make edits or want to make sure they are current. Here is the script
#!/bin/sh
#Sync User Dictionaries for Illustrator
#Current user
user=ls -l /dev/console | cut -d " " -f 4
#Duplicate current Dictionary file
cp /Users/$user/Library/Application Support/Adobe/Linguistics/UserDictionaries/ATE User Dictionary/all/added.txt /Users/$user/Library/Application Support/Adobe/Linguistics/UserDictionaries/ATE User Dictionary/all/BUadded.txt
# Cat dictionary file to server stored Dictionary file
cat /Users/$user/Library/Application Support/Adobe/Linguistics/UserDictionaries/ATE User Dictionary/all/added.txt /Volumes/Mac_Assembly/NEW_Script/MasterDictionary/addedsync.txt > /Users/$user/Library/Application Support/Adobe/Linguistics/UserDictionaries/ATE User Dictionary/all/addededits.txt
# Copy edited file in place of old file.
cp /Users/$user/Library/Application Support/Adobe/Linguistics/UserDictionaries/ATE User Dictionary/all/addededits.txt /Users/$user/Library/Application Support/Adobe/Linguistics/UserDictionaries/ATE User Dictionary/all/added.txt
#Copy new dictionary back to the server
cp /Users/$user/Library/Application Support/Adobe/Linguistics/UserDictionaries/ATE User Dictionary/all/added.txt /Volumes/Mac_Assembly/NEW_Script/MasterDictionary/addedsync.txt
This works but the file just copies the same thing over and over again. I need it to just add the latest additions to the text document.
Solved! Go to Solution.
Posted on 02-01-2014 04:01 AM
I don't know this dictionary. Does line order matter? If not, you could just do a sort command to pull out duplicate lines.
sort bigfile.txt -u -o lessbigfile.txt
the 'u' means unique lines only. -o means output file.
If sort order does matter, you'll have to go through each line in the script, grep for it, then output if necessary. -t-
Posted on 02-01-2014 04:01 AM
I don't know this dictionary. Does line order matter? If not, you could just do a sort command to pull out duplicate lines.
sort bigfile.txt -u -o lessbigfile.txt
the 'u' means unique lines only. -o means output file.
If sort order does matter, you'll have to go through each line in the script, grep for it, then output if necessary. -t-
Posted on 02-04-2014 12:34 PM
using
sort -uf worked perfectly
Thanks!