As it says in the title; if yes, I would, of course, need a bash-like pipe in order to use it comfortably.
Is there a grep equivalent in TACL on HP-Nonstop?
962 views Asked by Benjamin Zach AtThere are 3 answers
Grep does many things.
If you are looking in a specific file for a string, the command: EDIT R;LB/String/All;E
will look in single Editable files (type 101).
If you are looking in multiple files in a $. directory, there isn't any HPNonStop utility to accomplish that.
You could surround the single file example above with TACL code to look at all editable files. Something like:
FooFind
?TACL Macro
#Frame
#Push StringToFind FileName StopLoop Vol SubVol
#Set StopLoop 0
#Set StringToFind %1%
#SetMany Vol SubVol, [#Fileinfo/volume,subvol/[#Defaults/Current/ ].a]
[#If [#Empty [StringToFind]]
|then|
#Output Usage: Please supply the string to find
#Output EG: Foofind foo
|else|
#Set Filename [#Defaults/Current/].a
[#Loop
|do|
#Set FileName [#NextFileName [FileName]]
[#If [#Match [Vol] [#fileinfo/Volume/[FileName]]]
And [#Match [Subvol] [#fileinfo/Subvol/[FileName]]]
|then|
[#If [#Match 101 [#fileinfo/Code/[FileName]]]
|then|
Edit [FileName] r;lb/[StringToFind]/;Exit
|else|
#Output [FileName] is not an Edit file. Skipping...
] == end of if
|else|
#Set StopLoop -1
] == end of if
|Until| [StopLoop]
] == end of loop
] == end of if
#UnFrame
Execution:
$DATA FOO 73> foofind
Usage: Please supply the string to find
EG: Foofind foo
$DATA FOO 74> foofind foo
TEXT EDITOR - T9601L01 - (20OCT14)
CURRENT FILE IS $DATA.FOO.FOO1
TEXT EDITOR - T9601L01 - (20OCT14)
CURRENT FILE IS $DATA.FOO.FOO2
1 there is a foo here
TEXT EDITOR - T9601L01 - (20OCT14)
CURRENT FILE IS $DATA.FOO.FOO3
1 And a foo foo here.
TEXT EDITOR - T9601L01 - (20OCT14)
CURRENT FILE IS $DATA.FOO.FOOFIND
12 #Output EG: Foofind foo
$DATA.FOO.NOTEDIT is not an Edit file. Skipping...
$DATA FOO 75>
This is pretty rudimentary. There is lots of room for enhancements. But it does accomplish the task of looking for the input string in all editable files in a volume/sub-volume directory.
However, if you are looking for a grep-like utility that will search non-edit files, your best bet is to do something through a programming language.
If your system has
OSS
, you can usegtacl
.gtacl
allows you to start aTACL
aka a Guardian program directly fromOSS
, which hasgrep
natively.To switch sessions from Guardian
TACL
toOSS
, first typeosh
and then you can simply run yourTACL
commands viagtacl -c STATUS *, DETAIL
(this is a user status example).You can run all of your
TACL
commands this way while inOSS
, just as you would have to run all of yourosh
commands forOSS
asosh -c "ps -e~|egrep -e 'sshd~|prngd'"
(example osh process checks ssh) when in theTACL
session.