Link to home
Start Free TrialLog in
Avatar of bibi92
bibi92Flag for France

asked on

convert ksh commands to powershell

Hello,

How can I convert these commands ksh to powershell ?
typeset _CKID=`echo $0 | cut -d "." -f 2`
typeset _SID=`echo $0 | cut -d "." -f 1 | awk -F "_" '{print $NF}'`

Thanks

Regards

bibi
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Hey,

I'm not too familiar with awk, I can't figure out what that one is up to without test data.

cut is just splitting and can be replaced with -split. Awk may be doing something similar so you can always split again:
$typeset_CKID = ($args[0] -split '\.')[1]
$typeset_SID = ($args[0] -split '\.')[0] -split '_'

Open in new window

Chris
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bibi92

ASKER

Thanks regards bibi