problem in using cat and ended up with no space error in aix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem in using cat and ended up with no space error in aix
# 1  
Old 10-15-2009
problem in using cat and ended up with no space error in aix

While doing cat on a large file (3 GB file) , I am getting the no space error in the shell script hugefile.sh.

Eg: for i in `cat hugefile.txt`
do
echo "$i"
done

error: hugefile.sh[3]: no space

Please let me know your thoughts in handling this no space issue.
# 2  
Old 10-15-2009
The use of cat is redundant, try to read the file like this:

Code:
while read i
do
  echo "$i"
done < hugefile.txt

# 3  
Old 10-15-2009
maybe try perl next time?

The default shell of AIX is /bin/ksh (ksh88) and it uses an inefficient stack system. When you code the form "for i in <splat>" then ksh attempts to put <splat> on the stack. You're running out of memory. Splat.

However, ksh93 uses a different stack library that is more efficient and should work fine in this case. Other shells (like "bash") are more adept at handling such a large data set.

Wondering why ksh88 is not updated? It's the AIX default shell. All the system utilities, SMIT functions, etc. all use ksh. Changing the behavior even a little can have dramatic consequences.

You might also argue that IBM is simply protective of shell functions, or even just slow, since AIX's ksh93 is fairly far behind the opensource version. Or maybe the community is just that powerful...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to add space in front of cat values?

Hi, Hope you are all doing fine. The problem today i faced during my coding was i wanted to add a space equals to a tab character in front of all the lines which i am cat using tee command. Main file contents mainfile ... (4 Replies)
Discussion started by: mad man
4 Replies

2. AIX

Problem space used on AIX 5.3

Hello everyone, Sorry for my English but i'm French. I have a problem on an AIX 5.3 server on the occupation of a file system. When i run a df -m, this is what i get : Filesystem MB blocks Free %Used Iused %Iused Mounted on /dev/fslv09 3936.00 340.94 92% 7255 ... (8 Replies)
Discussion started by: Veis
8 Replies

3. Shell Programming and Scripting

Want non-interpretation of blank space using cat

I have a file say ADCD which is like following--> Please consider 'z' as space #cat ADCD <!--Yzzz|z--> <!--Nzzzzz--> Now I want to store the content of this file to a variable say VAR like this--> #VAR=`cat ADCD` #echo $VAR <!--Yz|z--> <!--Nz--> Now I don' t want the variable... (2 Replies)
Discussion started by: muchyog
2 Replies

4. AIX

Problem updating AIX 4.3.3 ML0 to ML11 - Error 0503-248

I am trying to apply Maintenance Level 11 to one of our older AIX machines that is currently at ML0. When I try to install the bos.rte.install for ML11 it gives the error 0503-248 stating: Verifying requisites... 0503-248 installp: Error: A fileset has parts that are different from one or more... (0 Replies)
Discussion started by: DMcNutt
0 Replies

5. Shell Programming and Scripting

Problem with cat

Hey all this is probably something simple but not sure why I am getting this error. Any help is appreciated. Expected output: $ ./ex_01.ksh word1 word2 word3 word4 arguments: word1 word2 word3 word4 Number of arguments: 4 what I am getting: ./ex_01.ksh word1 word2 word3 word4 cat:... (3 Replies)
Discussion started by: linuxn00b
3 Replies

6. Shell Programming and Scripting

Error while executing disk space script in AIX

#!/bin/ksh for AIX used=0 mount=${1:-"/mountpoint"} threshold=${2:-80} #message="hello" #SUBJECT="Disk Space Alert" #EMAIL="xyz@abcinc.com" used=`df -k $mount | grep % | awk '{print $5}' | sed 's/%//g'` #echo "Free Space available under \"$mount\" is `expr 100 - $used`%.\n">$message ... (6 Replies)
Discussion started by: rajeshw61
6 Replies

7. UNIX for Advanced & Expert Users

no space error in aix

While doing cat on a large file (3 GB file) , I am getting the no space error in the shell script hugefile.sh. Eg: for i in `cat hugefile.txt` do echo "$i" done error: hugefile.sh: no space Please let me know your thoughts in handling this no space issue. (2 Replies)
Discussion started by: techmoris
2 Replies

8. Shell Programming and Scripting

Have a basic 'for i in cat list' - Trying to get i to be set to a name with a space

Hi Have a file called ldap.list: ****** "o=unix forum" o=groups ****** i wrote a basic script that runs: for i in `cat ldap.list` do ldapsearch -h host -p 389 -b $i THE PROBLEM: - It looks like when the for i in cat ldap.list runs, it doesn't seem to care about the " ", it... (2 Replies)
Discussion started by: littlefrog
2 Replies

9. Shell Programming and Scripting

cat problem

Hello again; I have a file in this format ./this is/first/1 ./this is/second/2 ./this is/third/3 and i am using this file in a for loop with cat command like this for i in `cat directory.txt` do .......... done Bu there is a problem because my directory is "this is" but... (7 Replies)
Discussion started by: redbeard_06
7 Replies

10. UNIX for Dummies Questions & Answers

cat: write error: No space left on device

I am trying to create new files under my directory...but i getting the following message... cat: write error: No space left on device How do we handle this error. I am not getting this error when I login as the super user (3 Replies)
Discussion started by: igandu
3 Replies
Login or Register to Ask a Question