Need to separate the following value 'xxx.xxx.xxx.xxx:xx:xx'
I'm sure sed or awk will come into play here. But I can't figure 'em out!
I need to split a line of text, based on the first instance of colon ":". For instance, if I have the line 'xxx.xxx.xxx.xxx:yy:zz' I want a return of both the left ('xxx.xxx.xxx.xxx'), and the right ('yy:zz'). Any help? |
What language are you using? What did you try so far, and what happened?
|
One idea:
Code:
[mrbig]$ var=($(echo 'xxx.xxx.xxx.xxx:yy:zz' | sed 's/:/ /')) |
another
Code:
var1=($(echo 'xxx.xxx.xxx.xxx:yy:zz' | cut -d ':' -f 1)) Code:
var2=($(echo 'xxx.xxx.xxx.xxx:yy:zz' | cut -d ':' -f 2,3)) |
All times are GMT -5. The time now is 02:56 PM. |