Git Product home page Git Product logo

pipex's Introduction

pipex

Pipex 42 project badge

pipex is a 42 school project aimed to better understand shell redirection and pipes, by handling them in C.

This pipex program takes an input file, performs a command on it, pipes the result to another command which then writes its result to an output file. The result is virtually identical to this kind of shell command:

$ < input_file command1 | command2 > output file

🇺🇸 Read my articles in English about the concepts tackled in this project:

🇫🇷 Lire mes articles en français sur les concepts abordés dans ce projet :


Status

Finished 01/05/2022. Grade: 118% (here_doc bonus failed: prints an extra prompt line after LIMITER is given as input.)

Usage

To compile, use make, make all or make bonus.

Regular pipex execution

Pipex can handle 2 or more commands. To execute:

$ ./pipex input_file command1 command2 ... commandn output_file

The output will be written to the specified output file. If the output file exists, it will be overwritten. This replicates the shell command:

$ < input_file command1 | command2 | ... | commandn > output_file

Each command can be given arguments and options if surrounded by quotation marks. For example:

$ ./pipex example.txt "cat" "grep x" "sed s/l/.../g" outfile.txt

Pipex heredoc execution

You can also run pipex with a heredoc, like this:

$ ./pipex here_doc LIMITER command1 command2 ... commandn output_file

You will then be asked to input text which will be used as input for the commands. In this case, the specified output file will not be overwritten but appended, which replicates the behavior of the shell command:

$ << LIMITER command1 | command2 | ... | commandn >> output_file

Made by mcombeau: [email protected] | LinkedIn: mcombeau | Website: codequoi.com

pipex's People

Contributors

mcombeau avatar

Stargazers

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