mercredi 27 septembre 2017

How to compare part of two file names and use 'cat' to append them together

 #!/bin/bash
 for file1 in 
 /net/zmf8/cb/37/lxy161830/work/target_readcount/*.readcount.txt;
 do
 for file2 in /net/zmf8/cb/37/lxy161830/work/nontarget_readcount/*.nontargetreawdcount.txt;
 if [ $( basename${file1:0:1} ) == $( basename${file2:0:1} ) ];then
 cat $file1 $file2 > '*.readcount.txt'
 fi
 done

Here is my code but i just don't know how to compare two file names only the '*' part. And it always replied

./integrate.sh: line 5: syntax error near unexpected token `if'
./integrate.sh: line 5: `  if [ $( basename${file1:0:1} ) == $(basename${file2:0:1} ) ];then'

Aucun commentaire:

Enregistrer un commentaire