log parser 2.2 query, Text parsing and validating
There is a simple text file that have to be parse by using log parser. Just I started using log parser but not understanding What is its parsing limit. I mean Can i do such thing by using logparser
TextLine to parse:
1022303Name WXP3
This I have to parse like
First digit 1
is row name
022
is errorNumber
next three digit 303
is UserID
next ten char Name
is UserName
next 4 char WXP3
is SystemName
I am not able to understand can we do this query from log parser or not... If yes then give any sample query开发者_开发问答.
ANY OTHER TOOL TO PERFORM THIS IS MOST WELCOMED
You want the SUBSTR function.
logparser -i:textline "select substr(text, 0, 1) AS RowName, substr(text, 1, 3) AS ErrorNumber, substr(text, 4, 3) AS UserId, substr(text, 7, 10) AS UserName, substr(text, 17, 4) AS SystemName from temp.txt
This assumes the lengths are really set to a particular size.
temp.txt text used above:
1022303Name1 WXP3
1022303Name 2 WXP4
1022303Name 3 WXP5
1022303Name 4 WXP6
1022303Name 5 WXP7
1022303Name 6 WXP8
1022303Name 7 WXP9
1022303Name 8 WXPa
Since it's been linked to before, I'll also point you to Log Parser Plus, which I 'run,' and may be of some help with other log parser functions.
精彩评论