Hi,
Thanks for sharing the script. I would like to inform you that zgrep is now working fine on my AIX systems. As I mentioned earlier, I installed the gzip package, and initially, I ran the command using the full path. To simplify the task, I exported the path permanently, and after that, the command started working fine.
I used the following command to grep the files: # zgrep -il 'string' *.gz
------------------------------
Vivek M
------------------------------
Original Message:
Sent: Wed July 30, 2025 07:40 AM
From: Alexander Pettitt
Subject: Need similar tool of zgrep in aix server
I am near allergic to installing anything so I would do something like
for FILE in $(ls *.gz) ; do
gzip -dc ${FILE} | grep -ci [STRING] >/dev/null
if [[ $? -eq 0 ]] ; then
echo ${FILE}
fi
done
if you do it the other way I would make sure that you explicitly test the "zgrep" exists on the system in your script.
Going to save this to my interview questions list.
------------------------------
Alexander Pettitt
Original Message:
Sent: Wed July 30, 2025 01:31 AM
From: Vivek M
Subject: Need similar tool of zgrep in aix server
Hi Alexander,
I have already installed the gzip package and tried this command:
gzip -dc [FILE] | grep -i [STRING]
This command is useful to grep the word from all compressed files only, but my query is different. I want to grep and display the file names that contain the word from all compressed files.
------------------------------
Vivek M
Original Message:
Sent: Tue July 29, 2025 08:52 AM
From: Alexander Pettitt
Subject: Need similar tool of zgrep in aix server
Try gzip -dc [FILE] | grep -i [STRING]
Doubt you will need to install anything.
------------------------------
Alexander Pettitt
Original Message:
Sent: Tue July 29, 2025 08:49 AM
From: Vivek M
Subject: Need similar tool of zgrep in aix server
On many systems, there is a tool called zgrep
which is used to grep content from compressed files. Is there any similar tool available on AIX? My purpose is to grep a particular word from multiple compressed files and display the filenames that contain that word on an AIX server. Could you suggest the best RPM package or another command to solve this issue?
------------------------------
Vivek M
------------------------------