Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Grep integration would be awesome -- e.g. "find files with name satisfying x and content satisfying y", or (even better) "files in which grep query y is satisfied within n lines of a spot satisfying grep query y".


It does support regex expressions directly:

  ~= | =~ | regexp | rx       Used to check if the column value matches the regex pattern
  !=~ | !~= | notrx           Used to check if the column value doesn't match the regex pattern


    find $PATH -regex $FILENAME_REGEX -exec grep $CONTENT_REGEX

    grep -r [-E] $CONTENT_REGEX --include $FILEGLOB
Your bonus case:

    find $PATH -regex $FILENAME_REGEX \
        -exec sh -c "grep [-E] -$NUMBER_OF_CONTEXT_LINES $CONTENT_REGEX1 | grep -l [-E] $CONTENT_REGEX2"
The "[-E]" here is just to mention the command switch if you want to use extended regex.


Am I the only one that always creates an alias pointing grep to egrep? Not sure why I would ever want my regex to not be extended or why it would be fun to have to have to escape characters by default


Isn't this what pipes are for?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: