Skip to content

agkmw/go-tail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Go-Tail

A simple implementation of tail command from Linux in Go. It can be used to display the last few lines or bytes of a file. It supports reading multiple files concurrently and offer options to specify the number of lines or bytes to display.

Features

  • Display the last n lines or c bytes of a file.
  • Read multiple files concurrently.

Installation

  1. Clone the repository:
    git clone [email protected]:agkmw/go-tail.git
    cd go-tail
  2. Build the program:
    go build
  • Build the program with different name (<filename>.exe on Windows):
    go build -o <filename>
  1. Or install the executable to run it anywhere on your system:
    go install

Usage

./go-tail [OPTIONS] <filename>

Options

-n <number> : Display the last <number> of lines. -c <number> : Display the last <number> of bytes. +<number> : Display from the <number>th line or byte onward.

Examples

  • Display the last 10 lines of a file (default):
     ./go-tail file.txt
  • Display the last 20 lines of a file:
     ./go-tail -n 20 file.txt
  • Display the last 50 bytes of a file:
     ./go-tail -c 50 file.txt
  • Display from the 5th line onward:
     ./go-tail -n +5 file.txt
  • Display multiple files:
     ./go-tail file.txt file2.txt file3.txt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages