I have a 7z file that contains binary data and both large (>1Mb) and small (<1Mb) XML files.
I want to find only the small XML files that contain a specific string. I've tried using zgrep, but it seems to search inside all files.
Edit: What I ended up doing was writing a list of all xml files inside the .7z, grep only the lines with 6 digits numbers and copy only the filenames and extract them. Is there a more efficient way?
7z l test.7z *.xml > tmplist1
num="6"
grep -E "\s[0-9]{$num}\s" tmplist1 | grep -oE '[^[:space:]]+$' | sed "s/^/*/" > tmplist2
7z e -o/tmp test.7z -i@tmplist2 -aos
grep -E "*string*" /tmp/*.xml > tmplist3