Hello. I am really frustrated by this. I am trying to put a simple substr function into a Korn shell script to get the year into a korn shell variable. My problem is there is no substr function in korn shell script. And awk substr function only takes input files ! I looked into piping but not sure how to get my result back to a script variable. Here is my latest code in my korn script :
hosp = hosp92
hospno = ' '
echo $hosp | awk '{substr($1,5,2)}' > $hospno
Don't know if I can pipe to a variable or not. In rexx, or perl, it is so simple, but trying to substr in korn shell script, I need more examples on awk that work on $variables vs. from input files.
Can someone help me ?
hosp = hosp92
hospno = ' '
echo $hosp | awk '{substr($1,5,2)}' > $hospno
Don't know if I can pipe to a variable or not. In rexx, or perl, it is so simple, but trying to substr in korn shell script, I need more examples on awk that work on $variables vs. from input files.
Can someone help me ?