11-21-2006
I think this will be more robust.......u can test this script for as many files as u want.....
#!/bin/sh
#script to cat number of files given as an argument
if [ $# -eq 0 ]
then
echo " Enter the files which are to be catted as argument "
fi
if [ $# -eq 1 ]
then
echo " usage :: $0 <outputfile> <inputfile1> <inputfile2> ......."
fi
count=`expr $# - 1`
echo $count
echo $*
#shift jam1 > jam2
#cat jam2
#i=2
catfile=$1
while [ $# -gt 1 ]
do
echo $*
cat $2 $3 > jam
shift 2
done
cat jam > catfile
txs,
jam
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
What is syntax for String concatenation?
I have $1 as directory.
$var is some variable value
'/' String value.
How do I have to concatenate if I have to run utility -
util $1 followed by '/' followed by $var
There is no space between these three. (2 Replies)
Discussion started by: videsh77
2 Replies
2. Shell Programming and Scripting
I have written a script to find particular text files created within the last 24 hours and concatenate them all into a single concat.txt file. The problem that I am running into is that the last line of the text files do not terminate with <CR><LF> characters (as do all the other lines in each... (3 Replies)
Discussion started by: jvander
3 Replies
3. Shell Programming and Scripting
How can I do this:
date = 4 -----------> 04
Month= 3-----------> 03
I wish to make a varibale named Var1 which will hold the value of current date and month value as:
2 digits for date.
2 digits for month.
So finally var1 should hold value as 0403 --- MMDD (11 Replies)
Discussion started by: Asteroid
11 Replies
4. Shell Programming and Scripting
Hi,
I have two files.
cat file.txt
a
b
c
d
cat file1.txt
j
k
l
m
I need the output as
a:j (12 Replies)
Discussion started by: nareshkumar522
12 Replies
5. Shell Programming and Scripting
I have more than one files in a directory , namely
GLOW_OUT.txt
FIELD_OUT.txt
BASE_OUT.txt
...
SHOW_OUT.txt
What I wanted to do is to
I am working in Korn Shell
What I did was :
for file in <directory_name>/*.* ;do
cat $file | grep -v '^$' >> temp_file
rm $file
done
... (7 Replies)
Discussion started by: kumarjt
7 Replies
6. Shell Programming and Scripting
I have a script which is migrated from AIX to Linux & now while running it is no able to concatenate string values
The string concatenation step under while loop is not displaying desired result
Please find below the piece of code:
while read EXT_FILE ; do
EXT_FILE=$EXT_FILE.ext.sent
echo... (7 Replies)
Discussion started by: PreetArul
7 Replies
7. Shell Programming and Scripting
I have some files named as:
error_abc.txt
error_def.txt
error_ghi.txt
I want to concatenate all these into a single file say error_all.txt. The error_all.txt should be displayed like:
... (11 Replies)
Discussion started by: ankur328
11 Replies
8. Shell Programming and Scripting
awk '{$2=$2":"$8"-"$3;$3=$NF;$4=$NF="";print $0 | $10=$10":"$8"-"$18;$11=$NF;$12=$NF="";print $0 }' design.txt
Trying to concatenate specific fields in a spreadsheet and the others remain unchanged.
I attached an excel spreadsheet (all the data comes from a design.txt), but I put an example... (3 Replies)
Discussion started by: cmccabe
3 Replies
9. Shell Programming and Scripting
Hi,
I have a file containing many records delimited by pipe (|).
Each record should contain 17 columnns/fields. there are some fields having fields less than 17.So i am extracting those records to a file using the below command
awk 'BEGIN {FS="|"} NF !=17 {print}' feedfile.txt... (8 Replies)
Discussion started by: TomG
8 Replies
10. UNIX for Advanced & Expert Users
Hi,
I have the following reports that get generated every 1 hour and this is my requirement:
1. 5 reports get generated every hour with the names "Report.Dddmmyy.Thhmiss.CTLR"
"Report.Dddmmyy.Thhmiss.ACCD"
"Report.Dddmmyy.Thhmiss.BCCD"
"Report.Dddmmyy.Thhmiss.CCCD"... (1 Reply)
Discussion started by: Jesshelle David
1 Replies