Loans | Mortgages | Loans | Server Load Balancing | eBay
Want to do a substr in Korn shell [Archive] - PCMech Forums

PDA

View Full Version : Want to do a substr in Korn shell


jchoy
02-01-2003, 08:22 PM
Hello, I am maintaining a korn shell in which I just want to substr a variable to extract year 92 from hosp. Shell doesn't seem to have substr function so I was looking for awk substr function but, awk requires an input file or command keyboard input !

my korn shell coding looks like these, I am stuck at the awk statement :

#!/bin/ksh
sasname=hosp92
echo $sasname
year=awk '{substr($sasname,4,2)}'
echo $year
qa_core=qa_core${year}
logargs='-log ../log/${qa_core}.log -print'
echo $logargs