Skip to content
/ tailx Public

A lightweight utility to tail multiple files

Notifications You must be signed in to change notification settings

andirady/tailx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

tailx

A utility to tail multiple files

Decription

tailx only purpose is to tail multiple files and append the filename at the beginning of each line. I created this utility to be used in kubernetes where I want to tail multiple files to the stdout.

Usage

tailx file1.txt file2.txt

Sample output

file1.txt: content in file1.txt
file2.txt: content in file2.txt

Alternative

  1. Just use tail as follows

    tail -F file1.txt file2.txt

    This will output as follows:

    ==> file1.txt <==
    content in file1.txt
    
    ==> file2.txt <==
    content in file2.txt
    
  2. Use tail with awk (see this post)

    tail -F file1.txt file2.txt | awk '/^==> / {a=substr($0, 5, length-8); next} {print a": "$0}'

    This will output as follows:

    file1.txt: content in file1.txt
    file1.txt:
    file2.txt: content in file2.txt
    file2.txt:
    

    NOTE: The empty lines are part of the section separator, not the actual content of the files.

About

A lightweight utility to tail multiple files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published