| View previous topic :: View next topic |
| Author |
Message |
Nimos Halfop
Joined: 20 Apr 2008 Posts: 80
|
Posted: Sun Oct 26, 2008 7:01 am Post subject: Regexp |
|
|
| Code: |
p_id c_id ps bs pr br pl ping logintime idletime cprivs pprivs pflags ip nick loginname
1 8 18642 2650269 2007 306092 0 12 2891 16 0 4 0 "0.0.0.0" "GFSTD Ghost" "patrick"
3 8 6068 768886 13192 204185529 87 2108 2 0 0 0 "0.0.0.0" "TeRrOr_FiiL" ""
4 8 15599 2332631 1084 165532 100 51 1511 0 0 4 0 "0.0.0.0" "_Alexander | PuMa_" "PumaDAce"
5 8 15177 2266954 811 123634 0 39 1464 429 0 0 0 "0.0.0.0" "_Fab" " "
7 8 2167 322267 278 40845 36 98 235 164 0 0 0 "0.0.0.0" "GFSTD Raph" ""
8 8 2047 304378 53 7117 1167 48 208 0 0 0 0 "0.0.0.0" "x3_Diana_x3" ""
OK
|
For my Teamspeak Viewer, I have this Output from Telnet.
How can I filter this for just having:
GFSTD Ghost, TeRrOr_ FiiL, _Alexander | PuMa_, _Fab, etc... means only the nicks of the users as output?
Also I need something like "string range" backwards
Is there something like that? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Oct 26, 2008 11:38 am Post subject: |
|
|
The code below extracts all the available data, not only the nickname, but should be usable nevertheless.
| Code: | # ts_data holds raw data...
# Be adviced that there should be no newline within the regular expression below, although some browsers/editors may insert them to fit the code on the monitor (or other medium)
set nicklist [list]
foreach line [split $ts_data "\n"] {
regexp -- {([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+([[:digit:]]+)[[:blank:]]+"([[:alnum:][:punct:]]+)"[[:blank:]]+"([[:alnum:][:punct:][:space:]]+)"} $line all p_id c_id ps bs pr br pl ping logintime cprivs pprivs pflags ip nick loginname
#data is stored in the variables p_id, c_id, ps, bs, pr, br, pl, ping, logintime, cprivs, pprivs, pflags, ip, nick, and loginname.
#They are overwritten for each iteration (line of data), so make something useful with them within the loop or they'll be lost...
lappend nicklist $nick
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|