Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avifenesh/sortlogfiles
Algorithm for sorting multiple sorted log-files into one sorted log-file base on time-stamp
https://github.com/avifenesh/sortlogfiles
algorithm filesort heapsort log logfiles minheap python spacecomplexity timecomplexity
Last synced: 2 days ago
JSON representation
Algorithm for sorting multiple sorted log-files into one sorted log-file base on time-stamp
- Host: GitHub
- URL: https://github.com/avifenesh/sortlogfiles
- Owner: avifenesh
- Created: 2021-07-18T10:02:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-19T11:19:43.000Z (over 3 years ago)
- Last Synced: 2024-02-19T07:25:55.059Z (9 months ago)
- Topics: algorithm, filesort, heapsort, log, logfiles, minheap, python, spacecomplexity, timecomplexity
- Language: Python
- Homepage:
- Size: 1.99 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sortLogFiles
## Algorithm for sort multiple sorted log-files into one sorted log-file base on time-stampThe main idea behind the algorithm:
Create objects from every file, every object contain the index of the current comparing line, time-stamp of the the line and path to the file.
Create min heape base on time-stamp value and insert all the log-file objects.
Then pop the min and insert it to a new file.
After popping a line to the new file, get the next line of the file object and heapify the object to the right place base on the new time-stamp value.
## How to use:
Pull repo to your machine.
Open command line and navigate to the repo directory.
Write in the command line: python main.py -d [path-to-log-files]
If the path containing white spaces encapsulate the path by quotation marks.