grepWin icon indicating copy to clipboard operation
grepWin copied to clipboard

output result to console/file

Open jiangweiatgithub opened this issue 3 years ago • 9 comments

Is there any way to output the result to the console or a file without showing the dialog?

jiangweiatgithub avatar May 04 '21 09:05 jiangweiatgithub

indeed, I don't see any command-line params at https://tools.stefankueng.com/grepWin_cmd.html to save a file with the results.

Would expect: a) file output b) clipboard output c) console output options (maybe even all at the same time)

ideally should have params to

  1. save all (as copy context menu action does [OR DOESN'T - SEE NEWER COMMENT] if you first press CTRL+A to select all)
  2. save same as "Copy paths to clipboard"
  3. save same as "Copy filenames to clipboard"
  4. save same as "Copy text results to clipboard" some of params 2,3,4 could be combined if 1 isn't given by the user. Obviously if 1 is given they're practically ignored. Could also have the 2,3,4 params as +/- switches so one could give param 1 (all) and then say use param 3 with a minus/off flag to not export the filenames in those results (at all targets given)

could combine with param to close window automatically and/or not show it at all (if possible) or at least have it open minimized and then close again

birbilis avatar Jun 09 '21 15:06 birbilis

actually it seems copy action is for copying the file (Windows Explorer related)

I remember there was an option to copy everything (all columns) but now I can't find it anymore, just find 2-3-4 options on the context menu if I select all at the results list

there's also a > button at bottom right but seems to save (and open file after that) a text file (would be nice if it was appending .txt btw to it) with only the filenames column. Doesn't seem configurable at settings what it exports

birbilis avatar Jun 09 '21 16:06 birbilis

I remember there was an option to copy everything...

probably I was mixing that with what Git Log has on popup (the Full Data option), not sure if it ever existed here

image

birbilis avatar Jun 30 '21 11:06 birbilis

Doesn't seem configurable at settings what it exports

Capture Maxthon20210813114801

Gazeld avatar Aug 13 '21 10:08 Gazeld

Thanks for the tip, hadn't noticed the export dialog had those options - if it remembers them (haven't tried) it's similar effect to having config options for those. So one could at least configure them visually and then have some way to export results without showing the UI (from the command-line). Ideally though options should be at either config file or as parameters

birbilis avatar Aug 13 '21 11:08 birbilis

I need the console/file output to send a scheduled email with the search result.

thecocce avatar Aug 26 '21 14:08 thecocce

I just wanted to use grepWin for quick searches in a tool chain in the console/batch programming. I was surprised that it is not possible to store file paths of the search result, or to output them to the console, without having to interact with a GUI. This would make grepWin much more versatile!

ternite avatar Mar 16 '22 09:03 ternite

I do think having a bit more of a structured output for saving the search results would be a nice improvement. Saving the output as more conventionally correct CSV (correctly quoted and escaped where necessary, includes headers, etc.) so that it could be opened with Google Sheets or Excel to further manipulate would be nice. The current export is usable, but it's a very bare-bones dump of the gridview. Sure, it's really similar to grep's output, but asterisk-delimited instead of colon-delimited, but I'm not sure if that's really all that usable. I'd rather have the option of a standard Grep format (colon-delimited) and CSV.

That said, I think people are kind of asking for some features in the wrong place. grepWin is primarily targeted as a GUI interface for ad hoc searching. If you need something repeatable or to manipulate it from the command line, you should be looking at actual grep (it's available for Windows) or Powershell's Select-String or even ye olde findstr.exe or similar. GrepWin is a great tool that I use daily, but it's not the only tool that does this task. Existing command line and scripting options are going to have very robust command line features that will meet your needs better than the subset of features that grepWin might choose to add.

AikenBM avatar Mar 30 '22 17:03 AikenBM

I think people are kind of asking for some features in the wrong place.

Essentially, you're right. The fact, though, that grepWin offers a command line interface is a bit misleading in this regard.

Thanks for pointing out alternatives! Didn't know there is a command line grep available for Windows.

I achieved what I wanted to do 2 weeks ago by using findstr.exe.

ternite avatar Mar 31 '22 07:03 ternite