windows scripting - Unable to parse string (containing path) separated by delimiter -
I have a problem parsing a string, which contains only directory paths eg., E.g.,
My input string should be ABC program files sample
my output should be ABC // program file // sample
to script any It should also work for the length of the input path, there can be no one in it. The subdirectory (e.g., ABC \ Template \ sample \ folder \ joya)
I have helped many links but there is no use. It seems that only a full line or string (when we use the word 'token' for 'syntax') for the command, but my problem is that I do not know the length of the input path And so, no, no. Of tokens
My idea was to use it as a delimiter and then we had to remove each word before and after it, and put the words in the output file until we got the string.
I tried to apply the following but it does not work:
@echo off FOR / F "delims = \"% x (in the orig.txt) Do not (if not %% x == "echo. %% x //> output.txt)
The file is only one line in the orig.txt, namely, ABC \ Program Files \ Sample
My output includes only: ABC //
The above output is empty even after 'ABC //'
My desired The output should be: ABC // program file // sample //
Can I help with S?
Regards,
TechNext
Have you tried to match the pattern? I know in Perl and Java that you can make a simple replacement that gets all the "\" and changes them with "//"
In example perl:
my $ Var = "ABC program files \ sample \" $ var = ~ tr / \\ / \ / \ //;
Just look for pattern matching or regex
Comments
Post a Comment