The errors can be saved in a regular file if needed.Įxemple : find. To avoid this, redirect error messages to /dev/null. size +2G -print Redirecting error messagesĭue to access rights in some directories, the find command may produce a large number of error In practice, the unit ( k | M | G) is specified to avoid computing the multiples of 512 bytes. To identify *.html files whose size is greater than 50K (i.e. daystart -mtime -2 -name "*.html" Searching by size Specify daystart to use the real number of days without considering the current time. The option -mtime -2 means -48h, the option -ctime +30 means +30 × 24h : by default find uses the current date and the current time. To find *.json files created more than 30 days ago in the directory $LOG : find $LOG -ctime +30 -name "*.json" | sort. To find *.js or *.css files modified less than 2 days ago : find. images/google-analytics-optimisation-mesure-audience-02.jpgīy default, results are not sorted, that’s why in the above example sort is applied on the output of the find command. images/google-analytics-optimisation-mesure-audience-01.jpg images/conception-html-equations-math-mathjax-asciimath-01.jpg gif extensionīut not containing the keyword gimp in the name : find. To find in the current directory all files with the. c extension in the directory /usr : find /usr -name *.c -print /usr/share/bison/yacc.c The find command is recursive, directories and subdirectories are scanned by this command. Without at least this option,Įven if the search is successful, find displays nothing to the standard output. The find command is used at least with the option -print. \( critere1 -o critere2 \) : logical OR.\( criteria1 criteria2 \) or \( criteria1 -a criteria2 \) : logical AND.He took the name from the ed command string g/re/p, which translates as "global regular expression search.Search criteria can be combined using logical operators : Thompson spent about an hour that evening making his tool a general utility that could be used by others and renamed it as grep. He needed a tool that could search for phrases and strings within text files. McMahon was trying to identify the authors of the Federalist papers through textual analysis. His department head at Bell Labs, Doug Mcilroy, approached Thompson and described the problem one of his colleagues, Lee McMahon, was facing. Ken Thompson had extracted the regular expression search capabilities from the ed editor ( pronounced ee-dee) and created a little program - for his own use - to search through text files. The first two are bang on the third is slightly off. Thirdly, it was written overnight to satisfy a particular need. Secondly, the wealth of options can be overwhelming. The grep command is famous in Linux and Unix circles for three reasons. It also works with piped output from other commands. The Linux grep command is a string and pattern matching utility that displays matching lines from multiple files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |