[solved] Put an unknown string from a line into a variable:
Posted: 17 Jul 2010 08:12
---::[ ForeworD ]::---
First of all, greetz dear DosTips Admin(s) for keeping up this cool website. Second thanks a lot to all scripting enthusiasts for their job / good answers and tutorials / guides!
---::[ SituatioN ]::---
I got some files. Those files are more or less like that: (hashlog.txt)
---::[ AnalysiS ]::---
01) the output language ("The needed string for") may vary so no delims.
02) usernames are always different and may contain multiple 0x20 (space char)
03) the strings start always with "CK-84-010-" what follows vary and may contain multiple "-" char.
---::[ What did I do? ]::---
I already fully read DOS - String Manipulation, DOS - String Operations from DosTips.com and studied find and findstr commands. Even searching the forum itself before posting, but... Unfortunately I'm new to scripting as many other here I think, but I were not able to find a solution to my following problem:
---::[ What do i need? ]::---
Considering the above hashlog.txt example, I need to set a variable containing only:
01) goto a given line, in that case "go on line 2" (The needed string for Daneel Olivaw is CK-84-010-54602-c3f247c72f-15a7d2dbf)
02) look in this line the pattern "CK-84-010-" and when the pattern is found:
03) set a variable which includes the pattern+everything until the end of the string.
---::[ The most important thinG ]::---
Please, if anyone is willing to help me, I really do very appreciate it very much if you are going to show (even if it is a long) a very easy, step-by-step code and explain perhaps every line or at least tell on which internet page I may find the exact explanation.
---::[ ConclusioN ]::---
!!!Thank you very much in advance!!!
Respect2aLL
kind regards to the readers and
Best Regards to the helpers
(p.s.: hope this request-post was not too long/complicated
First of all, greetz dear DosTips Admin(s) for keeping up this cool website. Second thanks a lot to all scripting enthusiasts for their job / good answers and tutorials / guides!
---::[ SituatioN ]::---
I got some files. Those files are more or less like that: (hashlog.txt)
Code: Select all
System tool intern hash account report:
The needed string for Jack is CK-84-010-a1a067cf-6264006c-8955cb-7fba
The needed string for Daneel Olivaw is CK-84-010-54602-c3f247c72f-15a7d2dbf
The needed string for Jeff Jibba Oracle is CK-84-010-657f8b8da628ef-83cf69101b6817150a
---::[ AnalysiS ]::---
01) the output language ("The needed string for") may vary so no delims.
02) usernames are always different and may contain multiple 0x20 (space char)
03) the strings start always with "CK-84-010-" what follows vary and may contain multiple "-" char.
---::[ What did I do? ]::---
I already fully read DOS - String Manipulation, DOS - String Operations from DosTips.com and studied find and findstr commands. Even searching the forum itself before posting, but... Unfortunately I'm new to scripting as many other here I think, but I were not able to find a solution to my following problem:
---::[ What do i need? ]::---
Considering the above hashlog.txt example, I need to set a variable containing only:
Code: Select all
CK-84-010-54602-c3f247c72f-15a7d2dbf
01) goto a given line, in that case "go on line 2" (The needed string for Daneel Olivaw is CK-84-010-54602-c3f247c72f-15a7d2dbf)
02) look in this line the pattern "CK-84-010-" and when the pattern is found:
03) set a variable which includes the pattern+everything until the end of the string.
---::[ The most important thinG ]::---
Please, if anyone is willing to help me, I really do very appreciate it very much if you are going to show (even if it is a long) a very easy, step-by-step code and explain perhaps every line or at least tell on which internet page I may find the exact explanation.
---::[ ConclusioN ]::---
!!!Thank you very much in advance!!!
Respect2aLL
kind regards to the readers and
Best Regards to the helpers
(p.s.: hope this request-post was not too long/complicated