a new BASH question, howto get the 3rd - 5th char out of a name in a file
I need to know how to get the 3rd - 5th character in this situation:
Code:
[103050_rx30@rx30 ~]$ set - `cat deaopts.cnf` I'm sure there is some kind of awk or sed command that I can use to grab those characters, but sadly I just dont know enough yet to figure that out. Thanks in advance for the help. |
something like this:
echo $1 | sed ' s/^..\(...\).*$/\1/' |
Or if you want to stick with BASH:
echo ${1:2:3} In normal-speak, extract 3 characters from variable "1", starting at position 2 (it's 0-based). |
perfect guys, thanks.
|
All times are GMT -5. The time now is 10:45 PM. |