1st command reads all file as String and try to match over it, but in Linux shell your example creates pipes and links them (stdout to stdin) and the reading happens by big chunks. You can do the same in Linux:
s=`cat VMware.log`
echo "$s"|grep -v ...
PS2 is more close to reality, but chunk is very small, so you may to try: a) use bigger chunk size (for example multiple Mb) b) use one "Where-Object" with "-and" instead of 2 calls of "Where-Object" c) use -Like/-NotLike instead of -Match d) may be better will be -CLike/-CNotLike to avoid case-manipulations. Try '>' as in Bash to redirect the output
I'd just like to interject for a moment. What you're referring to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called "Linux", and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.
There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called "Linux" distributions are really distributions of GNU/Linux.
5
u/ka-splam Apr 27 '19
4.7GB logfile, 55 Million lines, most of them repeated that I wanted to strip out:
PowerShell attempt 1: 12 hours, 12GB RAM, didn't finish.
PowerShell, attempt 2: 45 minutes.
Git Bash attempt 1: 9.5 seconds
PS1
PS2
Git Bash: