I am currently working with Jupyter notebooks. With an IDE I used to be able to look for parts of my code that could be elsewhere, and thus refactor as needed.
Suppose I have the following code:
class.function('--parameter','-p', type = lambda x: operation(x,"%Y-%m-%d").date(),
default=unicode(previousTime-actualTime),
help='Send help'
)
The code is edited and is not meant to work or anything, I just want to exemplify the possibilty of there being multiple lines, multiple "strange" characters, quotes, and so on.
I now want to look where in my codebase that exact string exists.
I have been looking around and reading the manual and I have something like
grep -rxno . -e "string starts
more text here %% 'parameters inside quotes'
string ends"
But I feel like since it is a regular expression is matching me with substrings that are similar, not necessarily the same. Also, and more confusing, it's giving results line per line:
./DMP3K/DMP_3K.py:30:class.function(
./DMP3K/DMP_3K.py:31:
./DICC/diccionario.py:34: operation(x,"%Y-%m-%d").date()
I feel like there should be an easier way to do this operation that I am missing.
grep -zo "class.* )". For its locationgrep -n "class.fu"