Linked List

A personal knowledge base


sift is a fast and powerful alternative to grep.


#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:

  1. Find the text 'margin-top' (-n 'margin-top')
  2. 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+')
  3. In the app/assets/stylesheets directory
  4. Showing one line of context before the match (-B 1)
Last modified: 30 March 2016