Code Monkey home page Code Monkey logo

biglogsplit's Introduction

Text File Splitter

This Go script splits large log files into smaller parts. This project uses the Bubble Tea library for creating terminal-based UIs.

Features

  • Split Large Files: The program can split large log files into smaller parts, each of a specified maximum size.
  • Terminal Progress Bar: The progress of the file splitting is displayed as a progress bar in the terminal.
  • Completion Message: Once the file is fully split, a completion message is shown, and the program waits for a key press before exiting.

Installation

  1. Prerequisites: Make sure you have Go installed on your machine. You can download and install Go from here.

  2. Clone the Repository:

    git clone https://github.com/yourusername/yourrepository.git
    cd yourrepository
  3. Install Dependencies:

    go get github.com/charmbracelet/bubbletea
    go get github.com/charmbracelet/bubbles/progress
  4. Build the Program:

    go build -o file-splitter

Usage

  1. Prepare a config.json File:

Create a config.json file in the root directory of the repository with the following structure:

   {
       "filePath": "path/to/input/file.log",
       "maxSizeMB": 200,
       "outputFolder": "path/to/output/directory"
   }
  • filePath: The path to the input log file that needs to be split.
  • maxSizeMB: The maximum size of each split file in megabytes.
  • outputFolder: The path to the directory where the split files will be saved.
  1. Run the Program:

     ./BigLogSplit

Example

Given a config.json file with the following content:

{
  "filePath": "C:\\Users\\yourusername\\Desktop\\LargeLogFile.log",
  "maxSizeMB": 100,
  "outputFolder": "C:\\Users\\yourusername\\Desktop\\SplitLogs"
}

The program will split LargeLogFile.log into parts of 100 MB each, saving them in the SplitLogs directory on your desktop.

Customization

You can adjust the speed of the progress bar by modifying the time.Sleep(50 * time.Millisecond) line in the splitFile function within the main.go file. Adjust the duration to control how quickly the progress bar updates.

Acknowledgements

  • Bubble Tea: A Go framework for building terminal applications. Learn more at Bubble Tea.
  • Go: The Go programming language. Learn more at golang.org.

biglogsplit's People

Watchers

Denisf 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.