Return the matched line and nothing else? #2427
-
I already have a set of switches to get the output I'm hoping for, but I'm curious if maybe there's a more succient way to handle this? Context: I have a directory with a bunch of CSV files, I want to extract certain lines and consolidate those into a new CSV file. I realized I could use ripgrep for this and it seems to be MUCH faster than PowerShell...however, I need the output to purely be the matched line...no extra whitespace (preferably), no line numbers, file names, headers, etc. I've scanned through the help output at least a few times now but haven't seen any shortcut way to do this. This is what I've got so far: rg -IN --color never --no-heading 'foo,bar,baz' Here I'm using these switches:
So this gets me exactly what I want, I was just curious to see if there was maybe a switch I didn't see that might get what I want. Obviously I don't need this since I already have a working solution. I'm just posting here out of curiosity. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Ah! I just realized that if I pipe the output to another command in PowerShell, that most of the extra "junk" gets stripped out anyway 🤦♂️ rg -I 'foo,bar,baz' | Write-Host So that gets me exactly what I wanted. |
Beta Was this translation helpful? Give feedback.
Ah! I just realized that if I pipe the output to another command in PowerShell, that most of the extra "junk" gets stripped out anyway 🤦♂️
So that gets me exactly what I wanted.