View Single Post
Old 10-23-2008   #5 (permalink)
Flowering Weeds


 
 

Re: Looking for something better than split and join

Quote:

>
> The problem is that split-path
> replaces each slash with a
> backslash in case of this:
>
> PS > split-path "/vol/InfraDev_AppDev03/VHD.lun" -Parent
> \vol\InfraDev_AppDev03
>
Mmm data parsing!

Perhaps do it the same way
in any Windows process!

So using the _automation_ tool,
powershell.exe:

$path = "/vol/InfraDev_AppDev03/VHD.lun"

$path | LogParser.exe "SELECT
EXTRACT_FILENAME(text) AS Filename,
STRCAT(
EXTRACT_PATH(text), '/') AS Path
FROM STDIN " -i textline -stats off

Returns:

Filename Path
-------- ----------------------
VHD.lun /vol/InfraDev_AppDev03/

Have some data parsing fun,
Log Parser it!


My System SpecsSystem Spec