mIRC Home    About    Download    Register    News    Help

Print Thread
Searching chat Logs, Filter everything out? #260045 22/02/17 07:30 PM
Joined: Feb 2017
Posts: 1
C
Cliffard Offline OP
Mostly harmless
OP Offline
Mostly harmless
C
Joined: Feb 2017
Posts: 1
Hello, Let's say I use mIRC for logging a Twitch Chat, Is it possible for me to go into the logs and to Just search for all logs by one particular user. For Example I may have Person A, B, C Talking in a chat. The logs will look like this.
<A> Hello
<B> Heya
<C> Hi
<B> How are you
<A> Not to bad

Now if I need for example to see the logs from just B is there a way I can make is so it will hide any one the logs from any of the users other than B so it will just look like;

<B> Heya
<B> How are you

Re: Searching chat Logs, Filter everything out? [Re: Cliffard] #260047 23/02/17 02:10 AM
Joined: Feb 2003
Posts: 2,688
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,688
This is my 90% polished Grep script. I've been using it for years.

Code:
; a_grep.mrc (Aliases)
; GREP by Raccoon 02-June-2013
;
; Usage:  /grep <["][path\]file_mask.*.log["]> <word_or_*globbing*_or_/regex/_pattern>
; 
; Examples:
;   /grep #irchelp*.log raccoon  |  This will search all #irchelp* logs for *raccoon* (globbing pattern)
;   /grep #mirc.efnet.*.log /khaled|madgoat/i  |  This will search EFNet #mirc logs for "khaled" or "madgoat" (regex pattern)
;   /grep c:\logs\mirc\2006\freenode\*.log *lilo*  |  Find any mention of "lilo" in your Freenode logs from 2006. (globbing pattern)
;   /grep "c:\program files\mirc\versions.txt" /mIRC v\d.\d\d/  |  Grep file(s) that has spaces in its path using quotes.
; 
; If you use "/.../" around your pattern, it treats it as a Regular Expression.  You cannot use the 'm' prefix, sorry.
; If your globbing pattern does not contain '*' or '?' then '*' will be automatically be placed on both sides of your pattern.

grep { ; by Raccoon 02-June-2013
  if ($0 == 0) { echo -aic info * Usage: /grep <["]file_or_mask["]> <globbing_or_/regex/_pattern> | return }
  ; /^(?:"([^"]+)"|(\S+)) (.*)$/
  if ("* iswm $1) { var %fullpath = $gettok($1-,1,34), %pattern = $gettok($1-,2-,34) }
  if (%fullpath == $null) var %fullpath = $1
  if (%pattern == $null) var %pattern = $2-
  var %path = $iif($nofile(%fullpath),$v1,$logdir)
  var %filemask = $nopath(%fullpath)
  if (/*/* iswm %pattern) { var %regex = g }
  if (!%regex) && (* !isin %pattern) && (? !isin %pattern) { var %pattern = * $+ %pattern $+ * }

  window -Deizj100000 @grep
  echo @grep -
  echo 5 @grep Searching $qt(%path) for files matching $qt(%filemask) containing: %pattern $iif(%regex,(regex))
  echo @grep -
  editbox -b1e9999 @grep Press DELETE to Abort ...
  set -e %grep.path %path
  set -e %grep.filemask %filemask
  set -e %grep.pattern %pattern
  set -e %grep.regex %regex
  set -e %grep.i 1
  set -e %grep.lines 1
  set -e %grep.matches 0
  set -e %grep.matchfiles 0
  set -e %grep.start $ticks
  _grep
}

_grep { ; by Raccoon 02-June-2013
  if (Press* iswm $editbox(@grep)) {
    var %ticks = $ticks, %dur = $int($calc((%ticks - %grep.start)/1000))
    var %dur = $iif($int($calc(%dur / 60)) < 10,0 $+ $v1,$v1) $+ : $+ $iif($calc(%dur % 60) < 10,0 $+ $v1,$v1)
    WHILE ($findfile(%grep.path,%grep.filemask,%grep.i,2)) {
      var %file = $v1
      if ($calc($ticks - %ticks) > 500) { .timergrep -oi 1 0 _grep | return }
      ;set -e %grep.lines $lines(%file)
      editbox -b1e25 @grep Press Space to Abort ... %dur $baton($calc((%ticks - %grep.start)/1000)) $&
        %grep.matches matches $baton(%grep.matchfiles) %grep.matchfiles $+ / $+ %grep.i files $baton(%grep.i) $replace(%file,%grep.path,.\) $baton(%grep.i) $&
        $qt(%grep.pattern)
      filter -fwph20n $+ %grep.regex %file @grep %grep.pattern
      if ($filtered) {
        echo 2 @grep $filtered matches in %file
        echo @grep -
        inc %grep.matches $filtered
        inc %grep.matchfiles 1
      }
      inc %grep.i
    }
  }
  else {
    echo @grep -
    echo 4 @grep Aborted.
  }
  echo 2 @grep Done. Found %grep.matches matches in %grep.matchfiles of %grep.i files for $qt(%grep.pattern) $+ .
  editbox @grep
  unset %grep.*
}

baton { return $mid(-\|/,$calc($1 % 4 + 1),1) } ; by Raccoon


;===============================================================================
; WGREP - Window Grep
; Usage:  /wgrep <word_or_*globbing*_or_/regex/_pattern>
;===============================================================================

wgrep { ; by Raccoon 20-Nov-2014
  if ($0 == 0) { echo -aic info * Usage: /wgrep *pattern* or /wgrep /regex/i | return }
  var %pattern = $1-
  var %regex = 0
  if (/*/* iswm %pattern) { var %regex = 2 }
  if (!%regex) && (* !isin %pattern) && (? !isin %pattern) { var %pattern = * $+ %pattern $+ * }

  window -aDeizj1000000 @wgrep
  echo -ic notice @wgrep Searching for %pattern ...
  echo @wgrep -

  var %wids
  var %matches = 0
  var %ticks = $ticks
  var %scon_i = 1
  WHILE $scon(%scon_i) {
    scon %scon_i
    var %win_i = 1
    WHILE $window(*,%win_i) {
      var %win = $v1
      var %wid = $window(%win).wid
      if ($istok(%wids,%wid,32)) || (%win == @wgrep) { inc %win_i | continue }
      var %wids = %wids %wid
      editbox @wgrep %matches matches... $network %win
      var %fline_i = 1
      WHILE 1 {
        if ($calc($ticks - %ticks) >= 10000) && (!%longsearch) {
          var %input = $input(This search is taking a long time. $+ $crlf $+ $crlf $+ $&
            Would you like to continue searching?, y, /wgrep)
          if (!%input) { echo 4 -ei @wgrep Aborted. | editbox @wgrep | halt }
          var %longsearch = $true
        }
        var %line = $fline(%win,%pattern,%fline_i,%regex)
        if (!%line) { break }
        var %text = $line(%win,%line)
        var %color = $line(%win,%line).color
        inc %matches
        echo %color @wgrep $gettok(%win,1,32) %text
        editbox @wgrep %matches matches... $network %win ... %fline_i
        inc %fline_i
      }
      if (%fline_i > 1) { echo -ic notice @wgrep * $calc(%fline_i - 1) matches in $network %win for %pattern }
      echo @wgrep -
      inc %win_i
    }
    inc %scon_i
  }
  scon -r
  echo -eic info @wgrep Found %matches matches for %pattern
  editbox @wgrep
}


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: Searching chat Logs, Filter everything out? [Re: Raccoon] #267223 24/04/20 11:22 AM
Joined: Jan 2008
Posts: 9
S
SyntaxError Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
S
Joined: Jan 2008
Posts: 9
Did i copy something wrong, or do you have to take out the space between the logfile and search string.
[Linked Image from i.imgur.com]

Last edited by SyntaxError; 24/04/20 11:23 AM.