How to view multiple log files as one file in unix/linux
-
I was wondering if there is a convenient way in linux/unix to read multiple log files as one. More specifically, I would like to view a sequence of log files (app.log, app.log.1 app.log.2, etc) as one big file using normal unix tools (vi, less, etc). When the EOF is read the tool will automatically move to the beginning of the next file. During my work I have to analyze uat/prod logs to investigate and solve problems. The fact that I need to traverse many log files disturbs my work and causes delays. Any ideas?
-
Answer:
You can use lists of files and file globbing to specify multiple files. One big file: cat file1 file2 anotherbunch* log[a-z] | less A sequence of files (type :n to go to the next one): less -e file1 file2 anotherbunch* log[a-z] The -e switches to the next file automatically when the end of the current file is reached (twice) and exits when the end of the last file is reached (twice). To do that on the first time EOF is reached, use the -E option.
Kostas at Server Fault Visit the source
Other answers
Related Q & A:
- How to merge multiple CSV files into a single CSV file?Best solution by solveyourtech.com
- How do I scan multiple pages and email them into one file?Best solution by h30434.www3.hp.com
- How to move all music files into one folder?Best solution by stackoverflow.com
- How to view the committed files those you have not pushed yet?Best solution by Stack Overflow
- How to view and copy hidden files and folders in Linux?Best solution by Server Fault
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.