I am trying command cleartool lshistory > file.txt through this I am getting the file in text format similarly I want the log file in XML format.
Asked
Active
Viewed 124 times
1 Answers
0
cleartool lshistory
doesn't offer xml output.
You would need to parse its output, and generate the expected xml yourself.
akshay jain asks in the comments:
how we can get the logs in well formatted way so I can parse it easily and store the values in db?
Using fmt_ccase
, you can control exactly the ouput you want, for better parsing (as in this example):
cleartool lshistory -fmt "Element: %n| Date: %d| User:%u| Operation: %e| Object:%[type]p| SimpleType: %m| OperationKind: %o\n" -all /vobs/vob_name
The OP adds:
I want the version changes logs only not other logs, is there any way?
I mentions %c (comment message), but:
Is there a way to handle the
%c
output, because it is disturbing the format of log file?
I then mention %Nc, which avoid appending newlines at the end of the comment message.
The OP confirms in the chat:
%Nc
works thanks
-
how we can get the logs in well formatted way so i can parse it easily and store the values in db – Akshay jain Jun 18 '15 at 16:12
-
@akshayjain I have amended the answer to address your comment/question. – VonC Jun 18 '15 at 17:01
-
hi von i want the version changes logs only not other logs is there any way – Akshay jain Jun 19 '15 at 09:20
-
@akshayjain sure, look at the `fmt_ccase` man page I mention. `%n` should give you the version. What do you mean by "version changes log"? The checkin comment message? That would be `%c`. – VonC Jun 19 '15 at 09:42
-
is there a way to handle the %c output because it is disturbing the format of log file – Akshay jain Jun 19 '15 at 10:00
-
@akshayjain Can you try `%Nc`? (avoid appending a newline after the comment) – VonC Jun 19 '15 at 10:02
-
version changes means i want only the checkin logs in the log file at every checkin version/revision changes. – Akshay jain Jun 19 '15 at 10:08
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/80992/discussion-between-akshay-jain-and-vonc). – Akshay jain Jun 19 '15 at 10:14
-
@akshayjain Great, `%Nc` works for you. I have included it in the answer for more visibility. – VonC Jun 19 '15 at 13:42