Find the answer to your Linux question:
Results 1 to 5 of 5
Hi! I am having a problem getting a shell script to always successfully run. The script simply concatenates text files together that have similar prefixes, and outputs them to another ...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    15

    Basic shell script not working

    Hi!
    I am having a problem getting a shell script to always successfully run. The script simply concatenates text files together that have similar prefixes, and outputs them to another file.
    It works in many instances, but it seems to break if there are 7 or more instances of files with one of the prefixes in the directory it runs in. In the example below, if there were 7 or more files that started with 'INTFR', for example, the script may not work. The problem may also lie with the size of the files - I am not sure.
    Here is what it looks like:
    Code:
    cat /WORK/AREA/INTCCENT* > /WORK/AREA/INTCCENT1
    cat /WORK/AREA/INTDLY* > /WORK/AREA/INTDLY1
    cat /WORK/AREA/INTFR* > /WORK/AREA/INTFR1
    cat /WORK/AREA/INTJF* > /WORK/AREA/INTJF1
    cat /WORK/AREA/INTSAL* > /WORK/AREA/INTSAL
    rm /WORK/AREA/*.0*.S
    Does 'cat' not work under certain conditions? Is there some way to figure out why it is failing?

    Thanks!
    Charlie
    Last edited by devils casper; 04-02-2008 at 01:39 PM. Reason: Added [code]...[/code] tag.

  2. #2
    Just Joined!
    Join Date
    Mar 2008
    Posts
    26
    there's no reason I can see. maybe thry cating to a different directory. Maybe what's happening is the file is then created, and it's trying to cat the new file to itself?

  3. #3
    Linux Newbie
    Join Date
    Nov 2007
    Location
    Planet Earth
    Posts
    152
    I'm not sure, but maybe if you try:

    cat /WORK/AREA/INTCCENT* > /WORK/AREA/_INTCCENT1

    to avoid the concatenation of result file ...
    EOF

  4. #4
    Just Joined!
    Join Date
    May 2011
    Posts
    1
    I am having this same issue. Did you get it figured out?

  5. #5
    oz
    oz is online now
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,096
    Quote Originally Posted by nstong View Post
    I am having this same issue. Did you get it figured out?
    Hello and welcome to the forums, nstong.

    If you are having problems with Linux, please start a new thread of your own. This thread is over 3 years old, so locking it down.

    Thank you.
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...