Created
September 25, 2015 22:02
-
-
Save jasondewitt/e4906263bd013d19627a to your computer and use it in GitHub Desktop.
merge log files into a single file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export MFILE=merge_file.txt | |
export SFILE=complete_file.txt | |
for file in `ls *.log` | |
do | |
cat $file >> $MFILE | |
done | |
# -k1,2 represents the fields in the file containing the timestamps | |
# for this example field 1 was the date and field 2 was the time | |
# customize accordingly | |
sort -k1,2 $MFILE > $SFILE | |
rm $MFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment