简体   繁体   中英

What does the dot sign mean in the command

I am not very familiar with all Linux command line stuff. I need to find all the files with a suffix '.fvp' under a directory and all its sub-directories. I got it online, it works perfectly fine. But I didn't quite understand what it really means. The command line is as follows:

ls -R | grep '.*[.]fvp'

I know the -R option is for listing recursively and the pipe is for redirecting. Then why in the single quote, there is a dot before the asterisk and another dot within the brace. And whey not just '*.fvp'?

Thank you!

@Grep uses regular expression (regex) syntax as opposes to glob syntax that you may be used to. *.fvp is the glob expression for what you are trying to do, but with regexes, it is slightly different.

. in a regex matches any single character. * means any amount of the preceding character. So, .* means any character zero or more times. [.] means, as Marc B said, a literal period, because . already means something else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM