Giter Site home page Giter Site logo

printfile-utility's Introduction

PrintFile-Utility

This utility allows you to output the contents of a text file to a standard output stream. The program supports the following command line arguments (options):

  • -l, --lines=n - output only n (positive only) first (last) lines of the file (optional argument, by default all lines are output).
  • -t, --tail - output n last lines of the file (optional argument).
  • -d, --delimiter=c - character by which the end of the line is determined (optional, default is '\n'), parameter can be passed in single quotes, double quotes or no quotes at all.

Notes:

  1. Delimiter parameter can be passed in single quotes, double quotes or no quotes at all.
  2. You can specify a parameter for lines and delimiter only once.
  3. The --tail (-t) option can be entered as many times as you like.
  4. Options and file name can be arranged relative to each other as desired.

Requirements:

According to the requirements of lab-work, the use of the STL is prohibited.

Program start format:

PrintFile.exe [options] file_path

Launch examples:

PrintFile.exe -l 10 --delimiter='a' ./filename.txt - print the first 10 lines with delimiter character 'a'.
PrintFile.exe -d \t ./filename.txt --lines=123 - print the first 123 lines with a tab delimiter.
PrintFile.exe ./filename.txt -t --lines=12345 - print the last 12345 lines with the delimiter as a line break character.
PrintFile.exe --tail --delimiter=">" ./filename.txt -l 21 -t - print the last 21 lines with the delimiter as '>' character.
PrintFile.exe ./filename.txt - print the entire file.

Test file

File.txt content:

1;2;3;4;
5;6;7;8;
9;10;11;
12

Command line: PrintFile.exe File.txt --lines=5 -d ';'

Output:

1;2;3;4;
5;

Command line: PrintFile.exe File.txt --lines=3 -d ';' --tail

Output:

10;11;
12

printfile-utility's People

Contributors

dp1xter avatar

Stargazers

 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.