Git Product home page Git Product logo

gat's Introduction

Cat Command in Go

A Go implementation of the cat command used to concatenate file(s) and print the result to the terminal. This project replicates the functionality of the Unix cat command with additional features.

Features

  • Concatenate and display files.
  • Read from standard input if no files are provided or - is used.
  • Number all lines or non-blank lines.
  • Suppress repeated empty lines.
  • Display end-of-line characters.
  • Show tab characters.

Installation

Prerequisites

  • Go 1.18 or higher

Steps

  1. Clone the repository:

    git clone https://github.com/AvaterClasher/gat
    cd gat
  2. Build the project:

    go build -o cat.exe
  3. Add the directory containing cat.exe to your PATH:

    Windows

    • Open the Start Search, type in "env", and select "Edit the system environment variables"
    • In the System Properties window, click on the "Environment Variables" button
    • In the Environment Variables window, highlight the "Path" variable in the "System variables" section and click the "Edit" button
    • Click "New" and add the path to the directory containing cat.exe (e.g., C:\path\to\cat-go)
    • Click "OK" to close all windows
  4. Verify the installation:

    cat --version

Usage

cat [OPTIONS] [FILE]...

Options

  • -n, --number : Number all output lines
  • -b, --number-nonblank : Number non-blank output lines
  • -s, --squeeze-blank : Suppress repeated empty output lines
  • -E, --show-ends : Display $ at end of each line
  • -T, --show-tabs : Display TAB characters as ^I

Examples

  1. Basic Concatenation:

    cat file1.txt file2.txt
  2. Number All Lines:

    cat --number file1.txt
    cat -n file1.txt
  3. Number Non-Blank Lines:

    cat --number-nonblank file1.txt
    cat -b file1.txt
  4. Suppress Repeated Empty Lines:

    cat --squeeze-blank file1.txt
    cat -s file1.txt
  5. Display End-of-Line Characters:

    cat --show-ends file1.txt
    cat -E file1.txt
  6. Show Tab Characters:

    cat --show-tabs file1.txt
    cat -T file1.txt
  7. Combined Options:

    cat --number --show-ends file1.txt
    cat -n -E file1.txt
  8. Reading from Multiple Files:

    cat file1.txt file2.txt

License

This project is licensed under the MIT License. See the LICENSE file for details.

gat's People

Contributors

avaterclasher avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.