Thanks to visit codestin.com
Credit goes to github.com

Skip to content

thhofer/targrep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

targrep

Grepping within recursive tarballs

Goal

This utility function searches for a given pattern within recursive tarballs Within a single tarball, this can be achieved using zgrep -a pattern archive.tar, for instance. However, when a tarball may contain other tarballs, it can be more tricky to obtain

Sample use case

Input

  • parent.tar
    • child1.tar
      • subchild1-1.tar
        • path/to/file1.text
        • ...
      • subchild1-2.tar
      • ...
    • child2.tar
      • subchild2-1.tar
        • path/to/otherfile.text
        • ...
    • folder/otherfile.log

Usage

If searching for the string "ERROR" within any file contained in any of the tarballs, you would:

  1. Import the function: source targrep.sh
  2. Call the function: targrep "ERROR" parent.tar

Credits

Inspired by the code shared on stackoverflow: http://stackoverflow.com/a/13042529/3690491

About

Grepping within recursive tarballs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages