From e7946e8f2742cb657d3b21bd6d5e1b77a2d5363b Mon Sep 17 00:00:00 2001 From: athreyab Date: Tue, 1 May 2012 02:36:13 +0000 Subject: [PATCH] pair/singleton script update svn path=/; revision=327 --- .../athreyab/illumina_parse/create_pairs | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Personnel/athreyab/illumina_parse/create_pairs b/Personnel/athreyab/illumina_parse/create_pairs index 8626f03..e2fa2b4 100755 --- a/Personnel/athreyab/illumina_parse/create_pairs +++ b/Personnel/athreyab/illumina_parse/create_pairs @@ -1,10 +1,17 @@ #!/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 @@ -42,7 +49,7 @@ function process_file{ then line_index=0 fi - done < "${array[i]}" + done < "${array[$i]}" done } @@ -101,17 +108,18 @@ else # 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 -- 2.34.1