How do I filter out one character?
How do I filter out one character?
- Subject: How do I filter out one character?
- From: Jeffrey Madson <email@hidden>
- Date: Mon, 29 Oct 2018 14:53:29 -0500
As a newbie I have managed to write a script after a lot of borrowing and
testing that will insert the name of my Mac into System
Preferences/Sharing/Computer Name. The script pulls information from three
different data sources and in the end produces a name like
this: CA02673AC638520
The problem is that there is an extra character I need to filter out the
third character in every case so it should look like this: CA2673AC638520.
In the location code area of the script below I need to strip out the third
character. After many attempts I have been unable to do this. Any
suggestions?
#Generate ComputerName
if [ -z "$ComputerInfo" ]
then
computername="SiteCode-AssetTag"
else
#Set State, Location Code and Asset Tag variables
state=$(echo "$ComputerInfo" | cut -d',' -f1)
state=$(echo "${state//\"/}")
locationcode=$(echo "$ComputerInfo" | cut -d',' -f2)
locationcode=$(echo "${locationcode//\"/}")
assettag=$(echo "$ComputerInfo" | cut -d',' -f3)
assettag=$(echo "${assettag//\"/}")
#Generate the Computer Name
computername=$state$locationcode$assettag
fi
Thanks for your help!
MacGeek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden