Save what's between "," and what's before "=" to variables
Posted: 01 May 2013 10:56
Hello everyone.
I've searched through the web but I didn't manage to find anything so here goes.
I need two pieces of code, one that saves what's between "," Ex:.
I have a text file/variable with the following contents:
I would like the code to capture the ab,abb,ba.. to different variable like:
Also notice the the first word "ab" doesn't have a comman behind it and that the last word "te" doesn't have a comma in front of it. I can add the commas if they become to much of a trouble.
That was for the first code for the second one I was searching how to get the contents of what's behind a "="
I already have one that reads what's after the "=":
(By foxidrive)
But now I want to do it in reverse, Ex:.
Text file:
I would like a code to find b and provide 'a'. One at a time.
Thanks for reading and if you know the answer please help.
I've searched through the web but I didn't manage to find anything so here goes.
I need two pieces of code, one that saves what's between "," Ex:.
I have a text file/variable with the following contents:
Code: Select all
ab,abb,ba,asf,ade,te
I would like the code to capture the ab,abb,ba.. to different variable like:
Code: Select all
word#1=ab
word#2=abb
word#2=ba
...
Also notice the the first word "ab" doesn't have a comman behind it and that the last word "te" doesn't have a comma in front of it. I can add the commas if they become to much of a trouble.
That was for the first code for the second one I was searching how to get the contents of what's behind a "="
I already have one that reads what's after the "=":
Code: Select all
for /f "tokens=2 delims==" %%a in ('FINDSTR /C:"'a'" db.txt') do echo %%a
(By foxidrive)
But now I want to do it in reverse, Ex:.
Text file:
Code: Select all
'a'=b
'b'=c
'c'=d
I would like a code to find b and provide 'a'. One at a time.
Thanks for reading and if you know the answer please help.