|
|
|
|
|
by int_19h
2605 days ago
|
|
In fact, you don't even need to be in bash - WSL also installs a Win32 binary bash.exe, that redirects to Bash inside your default Linux install (there can be several). Which means that you can do this in cmd: bash -c "cat somefile.txt | sort | uniq > output.txt"
Since bash handles pipes and redirection in this case, it preserves Unix semantics exactly. And since WSL can see all your filesystems (they're mounted under /mnt/c, /mnt/d etc), and bash.exe maps current working directory, this works in any directory.This is much more tedious when you have to specify paths, because they have to be mapped explicitly, much like cygpath in Cygwin: bash -c "cat `wslpath -u 'C:\Temp\somefile.txt'` | sort | uniq > output.txt"
|
|