bash string processing
If the bash input parameter $1 is in the format "xyznnnnn", where "xyz" is fixed and "nnnnn" can be varied, how to extract the remaining of the string "nnnnn"?
e.g. If input is "xyzabc", then extracted string should be "abc". If input is "xyz12345678", then extracted string should be "12345678". Thanks in advance. |
you can read about bash string processing here
|
stripped_string=$(echo $1 | sed s/xyz//)
This is what I could do without looking it up in the Bash guide. Bash also has string functions. Take a look at the guide as pointed to in my signature. jlinkels |
Code:
bash-2.05$ x=xyz12345 |
All times are GMT -5. The time now is 08:14 AM. |