View Single Post
  #1 (permalink)  
Old 14-08-2008, 03:40 PM
eawedat's Avatar
eawedat eawedat is offline
Senior Member
User
 
Join Date: May 2008
Location: Palestine
OS: Kn0ck3D
Posts: 138
Thanks: 1
Thanked 2 Times in 2 Posts
Rep Power: 2
eawedat is on a distinguished road
Send a message via MSN to eawedat
Lightbulb How to "sed" things?

hey all,,
lets say that i type the command "date"
i wanna sed two things alone!
the time alone and date alone!
for example.
if i type "Date"
and this is the result below
Thu Aug 14 13:07:26 IDT 2008

i want to sed the whole line to be sorted time alone in new line and date alone in another new line.
which means the new result should be like this:-

Thu Aug 14
13:07:26

now,, there is a second question with regrads to the "sed" command.

i got this command which shows my ip address
who am i | sed 's/[^(]*(\([^)]*\))/\1/'
the problem thats sed command shows also character between the numbers which means it does not show the ip ,, but it shows the whole hostname.

for example if i type the command
who am i | sed 's/[^(]*(\([^)]*\))/\1/'
the result will be
sde-84-109-50-43.red.sde.net
now i need the numbers only

which means the new result should be
84.109.50.43 (with dots)

thank you very much.



Reply With Quote