Re: How do I filter out one character?
Re: How do I filter out one character?
- Subject: Re: How do I filter out one character?
- From: Takaaki Naganoya <email@hidden>
- Date: Tue, 30 Oct 2018 08:41:05 +0900
Do you mean to delete 3rd character?
set aText to "CA02673AC638520"
set bText to (text 1 thru 2 of aText) & (text 4 thru -1 of aText)
—> “CA2673AC638520"
--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/
> 2018/10/30 4:53、Jeffrey Madson <email@hidden>のメール:
>
> 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
_______________________________________________
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