Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
joecepy
- Posts: 27
- Joined: 28 Sep 2012 13:58
#1
Post
by joecepy » 27 Feb 2015 12:03
I have following text
10444 [] INFO 2015-02-25 00:57:59.040 TM1.Process Process QueBIT Sample - Turn On Cube Logging executed by chore Admin.Enable.Cube.Logging.30min.Interval
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project_lob_history' depends on cube '}ElementSecurity_project_lob_history'.
10444 [] INFO 2015-02-25 00:57:59.040 TM1.Process Process "QueBIT Sample - Turn On Cube Logging": finished executing normally, elapsed time 0.00 seconds
10444 [] INFO 2015-02-25 00:57:59.040 TM1.Chore Chore "Admin.Enable.Cube.Logging.30min.Interval" time = 0.00 seconds
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project' depends on cube 'CPX_DETAIL2'.
10444 [] INFO 2015-02-25 00:57:59.040 TM1.Chore Chore "Admin.Enable.Cube.Logging.30min.Interval" finished executing
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Chore Chore "Admin.Add.Cube.Dependencies@200AM" executed by scheduler
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Process Process Admin.Add.Cube.Dependencies executed by chore Admin.Add.Cube.Dependencies@200AM
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project' depends on cube '}ElementSecurity_project'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_}Groups' depends on cube '}ElementSecurity_project'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project_lob_history' depends on cube '}ElementSecurity_project_lob_history'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_}Groups' depends on cube '}ElementSecurity_project_lob_history'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project' depends on cube 'CPX_DETAIL'.
I need to get the line of text that contains TM1.Cube.Dependency and within that sentence I need to grab the UNIQUE items that are in single quotes.
So I'd retrieve the sentence:
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project_lob_history' depends on cube '}ElementSecurity_project_lob_history'.
and get '}ElementAttributes_project_lob_history' and '}ElementSecurity_project_lob_history'
continue to process the file but if I see the same items '}ElementAttributes_project_lob_history' and '}ElementSecurity_project_lob_history' it would ignore and continue to next. Of course this is done in batch only no 3rd party tools.
thanks in advanced.
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#2
Post
by foxidrive » 27 Feb 2015 12:33
Can you clarify your question?
Given the data you provided, what do you want in the output text file?
-
Squashman
- Expert
- Posts: 4471
- Joined: 23 Dec 2011 13:59
#3
Post
by Squashman » 27 Feb 2015 12:40
Sounds like a job for JREPL but you could do it with a simple FOR /F and then just dedupe the output file.
-
joecepy
- Posts: 27
- Joined: 28 Sep 2012 13:58
#4
Post
by joecepy » 27 Feb 2015 12:43
the items in a single quote so
'}ElementAttributes_}Groups' '}ElementSecurity_project'
'}ElementAttributes_project_lob_history' '}ElementSecurity_project_lob_history'
'}ElementAttributes_}Groups' '}ElementSecurity_project_lob_history'
'}ElementAttributes_project' 'CPX_DETAIL'
but it has to be unique. If it finds '}ElementAttributes_}Groups' '}ElementSecurity_project' again it would ignore that.
I can't delmit by ' because there are other line of sentence that contains ' quoted items. That's why I'm looking for the line of sentence that contains TM1.Cube.Dependency.
-
Squashman
- Expert
- Posts: 4471
- Joined: 23 Dec 2011 13:59
#5
Post
by Squashman » 27 Feb 2015 12:44
Little easier to visualize the data when it is in sorted order. Looks like a LOG file. How did the output get out of order?
10444 [] INFO 2015-02-25 00:57:59.040 TM1.Chore Chore "Admin.Enable.Cube.Logging.30min.Interval" finished executing
10444 [] INFO 2015-02-25 00:57:59.040 TM1.Chore Chore "Admin.Enable.Cube.Logging.30min.Interval" time = 0.00 seconds
10444 [] INFO 2015-02-25 00:57:59.040 TM1.Process Process "QueBIT Sample - Turn On Cube Logging": finished executing normally, elapsed time 0.00 seconds
10444 [] INFO 2015-02-25 00:57:59.040 TM1.Process Process QueBIT Sample - Turn On Cube Logging executed by chore Admin.Enable.Cube.Logging.30min.Interval
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Chore Chore "Admin.Add.Cube.Dependencies@200AM" executed by scheduler
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project' depends on cube 'CPX_DETAIL'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project' depends on cube 'CPX_DETAIL2'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project' depends on cube '}ElementSecurity_project'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project_lob_history' depends on cube '}ElementSecurity_project_lob_history'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_project_lob_history' depends on cube '}ElementSecurity_project_lob_history'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_}Groups' depends on cube '}ElementSecurity_project'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Cube.Dependency Adding cube dependency: Cube '}ElementAttributes_}Groups' depends on cube '}ElementSecurity_project_lob_history'.
10456 [] INFO 2015-02-25 01:00:29.859 TM1.Process Process Admin.Add.Cube.Dependencies executed by chore Admin.Add.Cube.Dependencies@200AM
-
joecepy
- Posts: 27
- Joined: 28 Sep 2012 13:58
#6
Post
by joecepy » 27 Feb 2015 12:48
I copied and pasted few lines to show there are duplicate items
-
Squashman
- Expert
- Posts: 4471
- Joined: 23 Dec 2011 13:59
#7
Post
by Squashman » 27 Feb 2015 12:49
joecepy wrote:but it has to be unique. If it finds '}ElementAttributes_}Groups' '}ElementSecurity_project' again it would ignore that.
That is not a duplicate in your EXAMPLE!
This is the only duplicate in your example.
ElementAttributes_project_lob_history' '}ElementSecurity_project_lob_history'
-
Squashman
- Expert
- Posts: 4471
- Joined: 23 Dec 2011 13:59
#8
Post
by Squashman » 27 Feb 2015 12:57
joecepy wrote:I can't delmit by ' because there are other line of sentence that contains ' quoted items. That's why I'm looking for the line of sentence that contains TM1.Cube.Dependency.
What do you mean you can't delimit?
Code: Select all
@echo off
FOR /F "tokens=2,4 delims='" %%G IN ('type input.txt ^|find "TM1.Cube.Dependency"') DO echo %%G %%H
pause
Output
Code: Select all
}ElementAttributes_project CPX_DETAIL
}ElementAttributes_project CPX_DETAIL2
}ElementAttributes_project }ElementSecurity_project
}ElementAttributes_project_lob_history }ElementSecurity_project_lob_history
}ElementAttributes_project_lob_history }ElementSecurity_project_lob_history
}ElementAttributes_}Groups }ElementSecurity_project
}ElementAttributes_}Groups }ElementSecurity_project_lob_history
Press any key to continue . . .
This gets you part way there. Now you can just run a 2nd set of code to dedupe the output.