Sorting the data saved from command-line
If you constantly work with NirSoft utilities, you probably already know that most of these utilities allows you to save the data into text, csv, html, or xml file from command-line, without displaying any user interface.
However, until now there was one drawback in this feature: The data was always saved in the original order, without any sorting.
So I finally started to add the command-line sorting feature into my utilities. I already added this sorting feature to the following 7 utilities, and I'll gradually add it also to the others: IECacheView, MozillaCacheView, CurrPorts, LiveContactsView, MyLastSearch, SearchMyFiles, and OpenedFilesView.
Here's a few points about using this sorting feature:
- For every utility that this feature is added, the data that you save from command-line will be sorted according to the last sorting that you chose from the user interface, by clicking the column header. If from some reason you still want to save the data without any sorting, like in the previous versions, you can still do that by using /nosort option, for example:
IECacheView.exe /shtml c:\temp\iec.html /nosort
- If you want to sort the saved data by another column, you can use the /sort command-line option. This option can accept a number as column index (0 for the first column, 1 for the second one, and so on) or the field name as appeared in the column header.
- For example, if you want to sort by the first column (in the current columns order):
IECacheView.exe /shtml c:\temp\iec.html /sort 0
- If you want to sort in descending order, you should add '~' character as prefix. For example, to sort the third column in descending order:
IECacheView.exe /shtml c:\temp\iec.html /sort ~2
- You can also sort by more than one column, simply by specifying multiple /sort parameters. For example: to sort by the second column, and then by the first column in descending order:
IECacheView.exe /shtml c:\temp\iec.html /sort 1 /sort ~0
- If you choose the specify the sorting column by its name, you must put it in quotes if the caption contains one or more space characters. For example, to sort by Content Type in IECacheView:
IECacheView.exe /shtml c:\temp\iec.html /sort "Content Type"
- If you want to sort in descending order, the '~' prefix must be inside the quotes, for example:
IECacheView.exe /shtml c:\temp\iec.html /sort "~Content Type"
- You don't have the type the exact column name. Even if you write a partial name of the column, my utilities will locate the right column. For example, if you want to sort by the 'Last Modified' column, you can specify only 'Modified' as column name:
IECacheView.exe /shtml c:\temp\iec.html /sort "Modified"
Notice: In all examples specified above, I used IECacheView utility to demonstrate the command-line sorting feature. However, you can use this feature in the same manner for all utilities that I add the sorting option.