Giter Club home page Giter Club logo

find_line's Introduction

FindLine

A simple grep-like script written in Ruby

Usage: ./find_line.rb directory_path regexp output_file_name_suffix(optional)

  • directory path - directory with files to search for occurrences of the pattern
  • regexp - pattern occurrences of which to search for
  • output_file_name_suffix - output file will be named result_#{output_file_name_suffix}.txt if this parameter is specified, otherwise it will be named result_#{regexp.inspect}.txt

Script stores log files in directory specified in LOG_PATH environmental variable. If that variable is not set, log files are being stored in the directory containing the script.

Script stores result files in directory specified in OUTPUT_DIR environmental variable. If that variable is not set, result files are being stored in the directory containing the script.

Warning: if your regexp contains characters that cannot be a part of file name in your operating system, the script will exit with error unless output_file_name_suffix is specified

Docker usage

With git repository

git clone https://github.com/Forinil/find_line.git
cd find_line
docker build -t find_line .
docker run -it --rm -v `$(pwd)`:/app/output find_line directory_path regexp output_file_name_suffix(optional)

With docker repository

Docker Hub repository

docker pull forinil/find_line
docker -t forinil/find_line find_line
docker run -it --rm -v `$(pwd)`:/app/output find_line directory_path directory_path regexp output_file_name_suffix(optional)

Of course there is no need to tag docker repository image with shorter name before using it, it is simply more convenient for repeated use.

Invoking docker run command as described above will copy the results to your current working directory.

If you want to access application log files after running docker image, you must mount a host directory to one inside the container and point the application to it by either specifying log_dir parameter or LOG_PATH variable (especially if you wish to avoid specifying regular expression as well).

For example:

docker run -it --rm -v `$(pwd)`:/app/output -v `$(pwd)`/logs:/app/logs -e LOG_PATH=/app/logs directory_path regexp output_file_name_suffix(optional)

The above command will work assuming there is a directory named logs in your current working directory

find_line's People

Contributors

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