How to parse in korn shell
Guys, I am having a problem, I have been using ksh script on my aix 52 that parse from the line and give me the file name but but when i try to use the same script on 5.3 it failed to parse,
here is my script line and sample output InterfaceFile=/law/t803/law/test/interface/smsptrf/rfdc0xk_0418152945 HDR_MASK=/law/test/law/test/interface/smsptrf/ FileName=${InterfaceFile##${HDR_MASK}} echo $FileName output should be "rfdc0xk_0418152945" but it is showing me the whole line /law/t803/law/test/interface/smsptrf/rfdc0xk_0418152945 any idea how can i fix or if there is any other way to get the same result please help me eddie |
What you're trying to do is parameter expansion - substrings (yeah, yet another strange name for something). The general form is
Code:
${parameter#pattern} remove small left pattern Code:
InterfacFile=/law/t803/law/test/interface/smsptrf/rfdc0xk_0418152945 Code:
rfdc0xk_0418152945 Hope this helps |
All times are GMT -5. The time now is 10:12 AM. |