Linux Commands: Difference between revisions

From miki
Jump to navigation Jump to search
(New page: == Frequently Used Shell Commands == * '''grep''' <pre> % grep -Rsl PATTERN [FILE] # recursive, no error output, only list filename </pre>)
 
Line 1: Line 1:
== Frequently Used Shell Commands ==
== Frequently Used Shell Commands ==


* '''grep'''
=== grep ===
% grep '''-Rsl''' ''PATTERN'' [''FILE''] # Recursive, no error output, only list filename
<pre>
% grep -Rsl PATTERN [FILE] # recursive, no error output, only list filename
% '''grep''' ''BASIC-REG-EXP-PATTERN'' [''FILE''] # Use classic regexp (like "dma\|DMA")
% '''egrep''' ''EXT-REG-EXP-PATTERN'' [''FILE''] # Same as grep -E. Use extended regexp (like "dma|DMA")
</pre>
% '''fgrep''' ''FIXED-STRINGS-REG-EXP'' [''FILE''] # Same as grep -N. Pattern is a list of strings to match.
% grep '''-n''' ''PATTERN'' [''FILE''] # Print matched line numbers.

Revision as of 00:52, 7 September 2008

Frequently Used Shell Commands

grep

% grep -Rsl PATTERN [FILE]            # Recursive, no error output, only list filename
% grep BASIC-REG-EXP-PATTERN [FILE]   # Use classic regexp (like "dma\|DMA")
% egrep EXT-REG-EXP-PATTERN [FILE]    # Same as grep -E. Use extended regexp (like "dma|DMA")
% fgrep FIXED-STRINGS-REG-EXP [FILE]  # Same as grep -N. Pattern is a list of strings to match.
% grep -n PATTERN [FILE]              # Print matched line numbers.