Sublime Forum

Grep within a file

#1

I’m not very technical. I love Sublime Text because it’s the best I’ve found for handling huge files and lots of data within the file.

I’m working on a file about 15 MiB.
I need to grep within the file then grep the result.
Currently I switch to a terminal to do this but it’s cumbersome.
For example:
grep -ri -C5 ‘frog’ /home/t.txt |grep -C5 -i ‘pond’ >r |subl r

Is there a quick way to do this within Sublime Text?

0 Likes

#2

You can open …

  1. the Find Panel via ctrl+f to search for text in the open document.
  2. the Find in Files Panel via ctrl+shift+f to search for text in several documents. The Where field can be used to specify the files to search in.
0 Likes

#3

Thanks! Much appreciated. After ctrl-shift-f I found the “context” toggle, which does what I want. I’d be curious to know how many lines “context” searches up or down.

0 Likes

#4

EDIT: seems like the problem is in pcmanfm, not in sublime text

EEEKK!
I’ve just discovered that when I cut and paste from the Find Results page which pops up after a Shift-ctrl-f search, it cuts and pastes a whole lot of crap I don’t want including square brackets and the name of the directory (all in some form of hidden text).
How can I prevent this behaviour?

EDIT: seems like the problem is in pcmanfm, not in sublime text

Sorry about that

0 Likes