0

i have two sets of text files in a directory with extension .ASC and .txt (1.ASC, 2.ASC, 3.ASC, 4.ASC....1000.ASC and 1.txt, 2.txt, 3.txt, 4.txt....1000.txt).

I just want to concatenate *.ASC file with *.txt file and want to save it to different named files like output_*.txt

for example ( i want to concatenate 1.ASC with 1.txt and output is output_1.txt, similarly concatenate 2.ASC with 2.txt and output is output_2.txt.....)

I tried the below script

#!/bin/sh

for file1 in *.ASC
do
for file2 in *.txt
do
cat file1 file2 > output_$1
done
done

But the written script does not give the expected output.please suggest a better solution for the same.Thanks.

manas
  • 479
  • 2
  • 14

0 Answers0