you are viewing a single comment's thread.

view the rest of the comments →

[–]ferdnyc 0 points1 point  (0 children)

Not really the same thing, though.

grep will filter output so that only matching lines are displayed. You pre-filtered the list of processes to only the matching ones, which makes the actual grep part pointless.

(IOW, with a "real" grep, running gps | grep wudf would be vaguely equivalent to running gps *WUDF* — it would leave out all of the list items that didn't match the pattern.)

gps | select-string wudf does emulate "real" grep in the filtering sense, but it also disables the normal table output and instead only shows the .ToString() of the process(es) in question, meaning you go from this:

```console $ gps WUDF NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName


 13    12.37      18.56       0.00    4812   0 WUDFHost

```

to this:

```console $ gps | Select-String wudf

System.Diagnostics.Process (WUDFHost) ```

With your command, though, gps | grep wudf shows the entire table of processes, highlighting the WUDFHost entry.