<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - bits</title>
<link>http://snipplr.com/users/bits/tags/pipe</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sat, 18 May 2013 22:24:18 GMT</pubDate>
<item>
<title>(DOS Batch) Split output of dir command into parts</title>
<link>http://snipplr.com/view/48725/split-output-of-dir-command-into-parts/</link>
<description><![CDATA[ <p>This example shows how you can split the output lines of e.g. a dir command. It also shows how to use a pipe to reduce the resulting lines by the findstr command.
Explanation:
This command calls "dir *.dll" and filters the results by findstr command through a pipe "|". The result of this is a list of all dll-files which contains the string "text" in it's name.
Now the for-loop takes each of these lines and splits them by the signs given in the "delims=.: " part. The "tokens=1,2,3" will send the first three parts of the split string to the explicit defined variable %i and the implicit defined variables %j and %k.
You can start counting your variables from every sign between a-z or A-Z. You will get more information about this on your command line with "for /?".

If you want to use this in a batch file, replace all % with %%.

This example will give you the date of alle found files in the format DD MM JJJJ (on a german windows box). If you use mor than three tokens or other characters as delims, you can get different results. Just play around.</p> ]]></description>
<pubDate>Thu, 10 Feb 2011 10:10:31 GMT</pubDate>
<guid>http://snipplr.com/view/48725/split-output-of-dir-command-into-parts/</guid>
</item>
</channel>
</rss>