#!/bin/bash
-function process_file{
- array=("$@")
- for i in "${array[@]}"
+function process_file(){
+ file_name="$1"
+ index=0
+ i=0
+ while read line ; do
+ array[$index]="$line"
+ index=$(($index+1))
+ done < "$file_name"
+
+ while [ $i -lt $index ]
do
- echo "processing file ${array[i]}"
+ echo "processing file ${array[$i]}"
while read line ; do
if [ $line_index == 0 ]
then
then
line_index=0
fi
- done < "${array[i]}"
+ done < "${array[$i]}"
done
}
# delete temp files as we dont' need them anymore. We already
# have that information in array1 and array2
- rm -f array1.txt
- rm -f array2.txt
-
i=0
line_index=0
out=""
remove_entry=0
# loop through each files in array1, filter them and put in a file
- process_file "${array1[@]}"
- process_file "${array2[@]}"
+ process_file "array1.txt"
+ process_file "array2.txt"
+ rm -f array1.txt
+ rm -f array2.txt
+
+
fi