Page 1 of 1

Find lines in files

Posted: 22 Apr 2020 23:22
by igurin
Background: I want to figure out what Python packages all of my IPython notebooks import.

What I know: How to find all files containing the word 'import'. I know that all of my notebooks contain this word, thank you very much.

What I want: A list of the actual import lines. (I have 96 notebooks, and I don't want to manually open each one to collect this information.)

After writing this post, I figured out that I can do this in Notepad++, but there I don't have Exclude or the other extra-cool options that XY has. It's probably good enough for now, but I'm still curious.

Re: Find lines in files

Posted: 22 Apr 2020 23:39
by highend
Not possible without scripting. The gui search will only list items, not gather specific content into <something> that you could output.

Re: Find lines in files

Posted: 27 Apr 2020 19:14
by igurin
Yeah, I guessed as much.

On the other hand, I guess I could use XY search to find the files I want, copy them to a temporary folder, and then use N++ search. Or, if I wanted to be super-fancy, grab a list of the paths and run it into Python.

Re: Find lines in files

Posted: 27 Apr 2020 19:16
by highend
Or you just do it from XY itself