Thread: redirecting confusion

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    192

    redirecting confusion

    Okay so I'm not really sure what I'm looking for but I can't find an example to figure it out.

    So if I had a directory with a bunch of files could be text files. the directory is text.
    and on linux I want to make a program that reads all the files in the directory so I want to use the redirect command on linux

    myprog < text

    what does my program to have to read the files in the directory "text"?
    like is there an example because all the redirect commands all have examples redirecting files but I want to redirect a directory.

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Code:
    for x in text/*; do cat $x >> somefile.txt; done
    somefile.txt will contain everything in text.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointer confusion. Please explain :)
    By nichya88 in forum C++ Programming
    Replies: 7
    Last Post: 01-26-2010, 12:18 PM
  2. Terrible confusion with time variables
    By LowlyIntern in forum C++ Programming
    Replies: 12
    Last Post: 08-01-2008, 07:23 AM
  3. Server-net newbie confusion
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 04-28-2005, 02:08 AM
  4. confusion with increment and decrement operators
    By cBegginer in forum C Programming
    Replies: 6
    Last Post: 03-19-2005, 03:45 PM
  5. redirecting standard error in Bash
    By wozza in forum Linux Programming
    Replies: 3
    Last Post: 07-16-2002, 04:55 AM