1

I moved away from Ubuntu to Debian, and having a problem with my find now for searching tex files for the word masi. Code and its output

masi@masi:~$ find -L "/home/masi/" -xtype f \
    -name "*.tex" -exec fgrep -l 'masi' {} + /dev/null

find: paths must precede expression: /dev/null
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
  • /dev/null is necessary in the second command set because we are using find -L, since we want to include all symlinks and go them through and not exclude anything in the search. Thread where the motivation for the use here about How to Avoid Many Levels of symlinks with this find?

As one-liner

find -L "/home/masi/" -xtype f -name "*.tex" -exec fgrep -l 'masi' {} + /dev/null

OS: Debian 8.5
Linux kernel: 4.6 of backports
Hardware: Asus Zenbook UX303UA
Related: find command of my haetex script in the thread How to search .tex files?
Find: find (GNU findutils) 4.4.2
Fgrep: grep (GNU grep) 2.20

1 Answers1

2

Just:

find -L /home/masi/ -xtype f -name "*.tex" -exec fgrep -l 'masi' {} +

no need /dev/null as far as {} is the place holder for the processed file(s)

If you try to hide the error output, use it like this :

command 2>/dev/null