soliauto.blogg.se

Find file containing text
Find file containing text











find file containing text find file containing text

Gzip: test_grep1.zip has more than one entry-rest ignored As you can see from the following example: gzip -d -c test_grep1.zip No wonder it doesn’t work well with zip files. Then I took a close look at zgrep, it is actually just a bash file wrapping grep & gzip (using gzip’s options “-c”, “-d” to decompress to stdout) as its man page states “zgrep - a wrapper around a grep program that decompresses files as needed” which zgrep But searching within test_grep.zip, it didn’t. When searching the string “jli” within test_grep1.zip, it found it. Zip test_grep.zip bbb.log unzip -l test_grep.zip Test_grep1.zip had aaa.log as the first one while test_grep.zip had bbb.log as the first file within the archive. It can only search the first file within the zip file.įor example, I created two zip files which contians two plain text files in different orders –aaa.log contained the string “jli” I was looking for, the other one bbb.log didn’t.

FIND FILE CONTAINING TEXT ZIP FILE

Using zgrep to searching a zip file doesn’t really work with two issues: I first tried the command zgrep because I wasn’t aware of zipgrep. When I got a request as mentioned above to grep a string within an archive, I didn’t know which commands to use and which commands for which scenarios. There are commands like zgrep and zipgrep. If you have never done this, you might ask - what tools to use? Are there existing commands which can be used instead of writing your own script to unzip the archive and search?įortunately the answer is yes. From time to time, you might need to search certain strings within an archive file in the zip format which contains multiple files on a Linux system.













Find file containing text