I use the "cat" command to cancaterate files into a new file.
Sometimes the cat command failed because there were too many files in the directory for cancateration.
I also tried to use the "ls" command to put the list of files into a text file and then cancaterate each file one by one by reading the text file. However when there are too many files, it failed the "ls" command as well.
The way to avoid too many arguments is not cramming the too many arguments into ls in backticks, or brackets, or anything else. Too many arguments is too many arguments no matter how you do it. It's an operating system limit.
The way to avoid too many arguments is to not use too many arguments. Often this means putting them through a pipe instead of putting them directly on the commandline. You had the right idea using ls, it is able to list them all, but just putting the output of ls into arguments gets you right back where you started. It's too many arguments no matter where they come from.
The xargs command is also useful, as it will convert arguments from a pipe into arguments on a commandline, running the command you ask it to with arguments limited to the maximum number the OS allows. If there are too many, it will run the program several times.
If for example, the maximum number of arguments was 4 and it had 10 files, it'd run "cat file1 file2 file3 file4", then "cat file5 file6 file7 file8", then "cat file9 file10". All the output of those would go into the same destination file, as if you'd run "cat file1 file2 file3 file4 file5 file6 file7 file8 file9 file10".
The real limit is much higher than 10 but hopefully that gets the idea across.
Hi All ,
Below is the script which I have written -
export LOGDIR=/home/rmsbatch/testdata
# TEMPDIR : Path where all non zero files need to be moved after search.
export TEMPDIR=/home/rmsbatch/testdata/TEMP
# RESULTFILE : Path of the Final File
export... (3 Replies)
I have two files as below
1.txt
AA 123
CC 145
DD 567
2.txt
AA 111
YY 128
CC 144
FF 222
DD 777
ZZ 875
basically 1.txt is updated file, if i do cat 1.txt 2.txt output should be as below
o/p (4 Replies)
I have two files as below
1.txt
AA 123
CC 145
DD 567
2.txt
AA 111
YY 128
CC 144
FF 222
DD 777
ZZ 875
basically 1.txt is updated file, if i do cat 1.txt 2.txt output should be as below
o/p (2 Replies)
Hi.
How can i write a command on AIX like the one i did at linux that find string in a file and show me that string, and return 3 lines before and 4 lines after that string.
my linux command is:
/bin/cat <filename> | tail -150 | grep -B2 -A8 "<string to look for>"
Example:
/bin/cat ... (10 Replies)
I have a file "sample.txt" with the content as below:
Hi
This is a Sample Text.
I need a single command using cat which serve the following purpose.
1.display the contents of sample.txt
2.append some text to it
3. and then exit
But, all should be served by a sinle... (1 Reply)
Hello,
So I sorted my file as I was supposed to:
sort -n -r -k 2 -k 1 file1 | uniq > file2
and when I wrote
> cat file2
in the command line, I got what I was expecting, but in the script itself
...
sort -n -r -k 2 -k 1 averages | uniq > temp
cat file2
It wrote a whole... (21 Replies)
hi everybody,
how do i open a txt file writen in unix on to a web page
so when i want to view the txt file that was generated from a shell program, that file is open on a web page
do i use the cat > filename.html command to do this, or is there another way
many thanks
:D (2 Replies)