UnxUtils is one of many port of the Unix command line tools to Windows. However, it has two additional tools which make the others tools a lot more useful in a Windows environment. They're called pclip and gclip.
pclip pastes the text on the Windows clipboard to standard output.
gclip puts text piped to it and puts it on the Windows clipboard.
For instance,
dir /b *.dll | pclipwill put the filenames of all dlls in the current folder on the clipboard, so you can paste them into Excel. That's a lot easier than marking and copying the text in the command prompt Window.
Another example is,
cat file.txt | pclipwhich will put the entire content of file.txt on the clipboard, while
gclip | sort | uniq | pclipwill remove all duplicated lines from the text on the clipboard (and, I admit, as a side-effect sort the lines as well).
The search and replace functionality of text editors is a lot easier to use than commands like grep and sed, but sometimes things that should've been easy in editors just isn't. In those cases, the command line can be easier. Just press CTRL-A, CTRL-C to get the text on the clipboard, do you're (p|g)clip magic on the command line, and press CTRL-P to paste the result back in the editor. It even works well with data in Excel (but not cells with formulas, obviously).
As a bonus, UnxUtils are native Win32 builds of the tools. No cygwin, and no Posix subsystem required.
These tools really belong in your %PATH%.
Ingen kommentarer:
Legg inn en kommentar