GithubHelp home page GithubHelp logo

danieldotwav / command-line-io-redirection Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7 KB

A short program that reads characters from the standard input until EOF (End Of File) is reached, printing each word on a new line. It considers a word to be any sequence of alphabetical characters, and treats any non-alphabetical character as a delimiter between words.

C 100.00%
c character-processing eof-handling standard-input-output word-delimiter

command-line-io-redirection's Introduction

Command Line IO Redirection

This simple C program is designed to read text input from the command line and redirect it to output with each word placed on a new line. Non-alphabetical characters are treated as word delimiters.

Description

The program processes each character input from the command line. When it encounters a letter (either uppercase or lowercase), it outputs that letter. Once it encounters a non-letter character, it treats it as the end of a word and outputs a newline character. This is especially useful for text processing in command line utilities where word-based formatting is required.

Usage

To use this program, you need to compile it first using a C compiler like gcc. Here's how you can do it:

gcc -o clioredirect main.c

Once compiled, you can run the program using:

./clioredirect

You can also use it with IO redirection or piping in a Unix-like environment:

cat yourfile.txt | ./clioredirect

Output

The program outputs each word detected in the input stream to the standard output, separated by a newline. A 'word' is defined as a sequence of alphabetical characters. Any non-alphabetical character is treated as a separator between words.

If you wish to save the output to a file instead of displaying it on the terminal, you can redirect the output to a file like this:

./wordseparator < path_to_your_file.txt > output.txt

Additional Information

  • The program does not differentiate between uppercase and lowercase characters. The words are output as they are read.
  • No additional libraries are required for the program to run, only the standard C library.
  • This program is designed to be simple and does not handle special text encoding or binary files.

command-line-io-redirection's People

Contributors

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