Need help in scripting

Hi,

I have 10 files and each file contain 100 records and i need to write a script to
merge all the 10 files into a single file.Before merging each file we need to add sequence no in the firstcolumn of each file.

eg:- file1
seq no : 0 -100(100 records in a first file)
file2
seq no :- 101 -200(100 records in a second file)
file 3
seq no :- 201-300(100 records in a third file)
and so on....
finally, we need to merge all 10 files in to a single file.

any help is much appreciated.

Thanks in advance

I will assume that when you said:

You meant:

The name of the files would make a major difference in the solution.

Considering the name of the files are "fileX" (where X is 1-10), then:

cat -n file? file10 > Big_File

you can try this example

File dx1

#cat dx1 
this is rec1
this is rec2
this is rec3

File dx2

#cat dx2
rec1
rec2
rec3
rec4
rec5

script

# !/bin/bash
for i in $(ls dx*)
do
    cat $i >> allnumber.txt
done
cat allnumber.txt | awk '{ print NR $0 }' > all_number.txt
rm allnumber.txt

---------- Post updated at 09:05 AM ---------- Previous update was at 09:04 AM ----------

Result

1this is rec1
2this is rec2
3this is rec3
4rec1
5rec2
6rec3
7rec4
8rec5

@jville

I like to change your script something like below.

# !/bin/bash
#for i in $(ls dx*)             --> use less use of ls command
for i in dx*
do
    cat $i >> allnumber.txt
done
# cat allnumber.txt | awk '{ print NR $0 }' > all_number.txt  --> useless use of cat
awk '{ print NR $0 }' allnumber.txt > all_number.txt
rm allnumber.txt