Not able to extract last column from awk
Hi All,
I have a basic question of awk. Code:
var=/test/build/create/sls Thanks, |
Hello,
If you're trying to get sls as a value, at least that's what I understand from the above, then you need to set your field separator to / instead of : and also if I'm not mistaking take the FS declaration outside the {} like this: Code:
echo $var | awk -F'/' '{ print $5 }' Kind regards, Eric |
Many Thanks sir,
Actually while posting I made that mistake of putting ":" instead of '/' . I did not have a chance to copy/paste from terminal. Thanks again !! |
Hi,
You're welcome. If you consider your problem solved then please mark the thread as such. Have fun with Linux. Kind regards, Eric |
As long as we realise that awk is in no way needed for this task??
Code:
echo ${var##*/} |
All times are GMT -5. The time now is 05:19 PM. |