Sift
sift is a fast and powerful alternative to grep.
Examples
Find Top Level CSS Classes That Define a Top Margin
sift -B 1 -n 'margin-top' --preceded-within '1:^\s+\.\w+' app/assets/stylesheets
This works as follows:
- Find the text 'margin-top' (
-n 'margin-top'
) - Preceded within 1 line of text matching
^\s*\.\w+
(start of line, 0 or more whitespace, a fullstop, 1 or more word characters) (--preceded-within '1:^\s+\.\w+'
) - In the
app/assets/stylesheets
directory - Showing one line of context before the match (
-B 1
)
Last modified: 30 March 2016