Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

how to fetch the logs from the log files

Hi Experts,

1.
test/xml
under this folder i have 100 xmls
i want to see specific tags along with value
 <empid>100</empid> .. so on
how to fetch using linux command .

2.while fetching logs
how to use more command
more info.log i am giving this command logs are showing .
after that how to trace a specific word

example:
more info.log
'textexample' i want to seach this word.

3.when to use more command and when to use less command.

suggest me best ways to trace the logs .
when log file size very huge and log is written in multiple files(i mean if i want to find logs in current and old files) how to fetch the specific word from all the logs.
SOLUTION
Avatar of Kimputer
Kimputer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
1) XML Parsing: You might be able to use html2text for this.

2) Log Parsing: cat logfile | grep textexample

3) Which command to use: The commands more + less are generally equivalent. The less command is more recent + tends to run much faster than more, across very large files. Either may be used, for the most part, interchangeably.
"The commands more + less are generally equivalent."

That has not been my experience.  I'm not a Linux expert, but we use Linux to run our Oracle database servers so I'm somewhat familiar with Linux.  With the "more" command, I can only advance through large files, one screenful at a time.  The "less" command also supports advancing through large files, one screenful at a time just like the "more" command does, plus it allows me to scroll back up, either by line or by a screenful at a time.  The "more" command does not allow scrolling back up, at least in the RedHat/Oracle versions of Linux that I've seen.

I've never noticed nor tested for a performance difference between them.
As I said, "The commands more + less are generally equivalent."

More or Less != Same.

At this point less is provided with every Distro + has been for years.

Most .bashrc startup files do something like...

which less >/dev/null 2>&1 && alias more=less

Open in new window


Also less does have many more options...

https://www.topbug.net/blog/2016/09/27/make-gnu-less-more-powerful/ covers a few... and...

More + Less are still basically the same. The present a file page by page.

Also of note is the view command which is runs vi in read only mode. This provides even more complex file movement than more or less.
Avatar of srikotesh
srikotesh

ASKER

hi kimputer/Experts,

as you said
 grep <empid>100<//empid> *.xml
this cmd will fetch the above tag alone

what I am asking is  I have 100xmls
I don't know the emp id's
I want all 100 emp id's from the list of  xmls
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks