/usr/share/epic4/script/grep is in epic4 1:2.10.6-1build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #
# grep 1.0 -- adds [e]grep support to the client, neat
# Author -- wd@anduril.org White_Dragon Chip Norkus
# Any deviation from the original is Jeremy Nelson's fault.
#
# Contributed to the EPIC project by Phoengold, on Fri, 14 Apr 2000.
#
# Usage: /grep [-w #] <text>
# /egrep [-w #] <text>
# Performs a text search on the lastlog of the current/specified window
#
# At the most basic level, /grep searches the lastlog of your current window
# for the specified text. with the -w option you can specify the window
# whose lastlog you want to use. A regular expression of any sort can be
# used, as well.
#
alias grep
{
^local win,exp,re,i,x,l,s.,l.
if (![$0])
{
echo Usage: /grep [-w #] <text>
return
}
@ win = 1
if ([$0] == [-w]) {
if (![$2]) {
return
}
@ win = [$1]
@ exp = [$2-]
}{
@ exp = [$*]
}
if (!winlevel($win)) {
assign -win
}
@ re = regcomp($exp)
### grep here, and save the lines
@ i = getset(LASTLOG)
@ x = 0
while (i)
{
@ l = line($i $win)
if (!regexec($re $l))
{
@ s[$x] = l
@ l[$x] = i
@ x++
}
@ i--
}
@ regfree($re)
echo ------------------ Results of grep: ----------------------
@ i = 0
while (i < x) {
xecho -nolog $[4]l[$i]: $s[$i]
@ i++
}
echo ------------------------ End -----------------------------
}
#WhiteDragon'Y2K
|