R
Robert Dober
No idea that was not my codeOn 7/10/07 said:cmd = string[/\s(\S+)$/, 1]
doesnt fetch me anything![]()
As simple as possible, but not simpler. Now we are in the simpler caseprogram=string.split.last
what if
string = "root 14051 14033 3 08:39 pts/2 00:00:00 /bin/bash -x
-s"
it fetches only -s for me.
But see below
Does not work the :\d+ stuff might be a parameter of the programprogram=string[/[a-z\/]+$/]
the command column mauy start with character. i dont want to limit it in
my regexp. it has to be generic.
with all your comments, i tried
pid = run_process[/\s(\d+)/, 1]
cmd = run_process[/:\d+:\d+\s(\S.*)\s$/, 1]
Yepis there any other way?
x = split
y= x[1]
z = x[7..-1].join(" ")
There might still be a pitfall though in case of some old processes
where you will have to analyse if the date takes one or two fields if
memory serves.
HTH
Robert