- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between grep and fgrep command
In any language or framework one of the most important and main feature is of searching the data. It not only denotes the performance of language but also represents in what manner the data is being stored. So specifically if we take an example of LINUX operating system there comes two of the important commands namely grep and fgrep.
Both of these commands are used to search any string or regular expression in file, directory or even in multiple folders. Both these commands executes in such a way that processor starts analysing the target folder or destination and search for the given string or data.
On the basis of execution of both of these commands following are the important differences.
|1||Definition||grep or Global Regular Expression Print is the command in Linux which can search for any type of string on any file or list of files or even output of any command.||On other hand Fgrep or the Fixed grep or grep -F is command in Linux which is again used in searching for the entire string instead of regular expression as it doesn’t recognize the regular expressions neither any meta-characters.|
|2||Implementation||For introducing the support of regular expression in search mechanism grep command is implemented in such a way that it consider regular expression and also meta-characters in the given search string and perform search along with them treating as separate than normal characters of the string.||On other hand implementation of Fgrep does not support regular expression or any meta-character in its search and treat them as part of normal characters of the string.|
|3||Data Searching||For data searching grep uses Boyer-Moore algorithm for fast searching any string or regular expression.||On other hand fgrep always uses the Aho-Corasick algorithm that worst O(m+n) complexity.|
|4||Regular Expression||As mentioned above grep always interpreted as regular expressions in the given string for search.||On other hand fgrep command interprets the PATTERN as a list of fixed strings separated by newlines.|
|5||Syntax||Syntax for grep command would be in form of "grep "." myfile.txt"||On other hand Syntax for fgrep command would be in form of "fgrep "." myfile.txt"|
- What is the difference between Grep and Filter in jQuery?
- Difference Between ALTER and UPDATE Command in SQL
- What is the difference between ls() command and objects() command in R?
- What is the difference between MySQL TRUNCATE and DELETE command?
- Difference between Write-Output and Write-Host command in PowerShell?
- What is the significant difference between MySQL TRUNCATE and DROP command?
- What is the difference between the New-AZTag and Update-AZTag command in Azure PowerShell?
- How to preserve colouring after piping grep to grep in Linux?
- Difference between C# and .Net
- Difference between Process and Thread
- Difference between Concurrency and Parallelism
- Difference between localhost and 127.0.0.1?
- Difference between JCoClient and JCoDestination
- Difference between String and StringBuffer.
- Difference between StringBuffer and StringBuilder.