0

Something like the answer here: https://superuser.com/questions/313187/search-text-in-multiple-excel-files but on linux mint..

xlsx files within a folder that contain the string

malaki106
  • 3
  • 4
  • Please [edit your question](https://unix.stackexchange.com/posts/550976/edit) to include this information. Did you try anything with `grep`? What were the results? Is the word search case-sensitive? – Jeff Schaller Nov 07 '19 at 18:50
  • Relating https://unix.stackexchange.com/a/401911/117549 and https://unix.stackexchange.com/q/442004/117549 and https://unix.stackexchange.com/q/23726/117549 and https://unix.stackexchange.com/q/494917/117549 – Jeff Schaller Nov 07 '19 at 19:00

1 Answers1

1

As a supplement to the linked answers in the comments.

Having had to search and recover a trashed file system full of un-backed up excel files this is a snippet of the script I used in a loop over several hundred large excel files to search for keywords. The filename is passed in as $f and the search string in $s. The middle line was just tidying up the output for my own purposes and you can probably throw it away.

found=$(unzip -p "$f" | grep -Pio -m 1 "$s" 2>/dev/null)
found=$(echo $found | sed 's/[ ,/]/./g')
echo "found $found in $f"

My advice is simply this ....don't forget -m 1 as an option to the grep to quit once you have found the first match or you will waste a lot of time.

bu5hman
  • 4,663
  • 2
  • 14
  • 29