How is FGREP 2 dash '-'?

fgrep -ircl --include=*.{sql} "[--]" *doesn't seem to do this trick. Please, help...

Thanks for the responses guys. I'm trying to replace "-" with "#", and it's hard for me. Here I created a new question . If you could help, that would be awesome.

+3
source share
5 answers

If you want fgrep all files ending with .sql, use

fgrep -ircl --include=*.sql -- -- *

or (note the comma in {sql,}:

fgrep -ircl --include=*.{sql,} -- -- *

If you want fgrep more than one type of extension, use something like

fgrep -ircl --include=*.{sql,txt} -- -- *

As already mentioned, the first --tells fgrep to stop searching for flags and options. The second --is a fixed-line pattern.

+1

, () -. -- " ", , ,

fgrep -ircl --include=*.{sql} -- -- *

" ", , .

+4

, (, [a-z]). , , .

, -- - , parsing . -- , :

fgrep -ircl --include=*.{sql} -- -- *
+1
source

Character characters can only be in the first position in brackets [], because they indicate the range [az] or [0-9]. You can do [-] [-].

+1
source

Try using single quotes '[--]'instead"[--]"

fgrep -ircl --include=*.{sql} '[--]' *
0
source

Source: https://habr.com/ru/post/1743412/


All Articles