Error:
$ awk '{ if ($0 !~ /^>/) { gsub(//, '-', $0); } print $0; }' test.fa
awk: cmd. line:1: { if ($0 !~ /^>/) { gsub(//, -, $0); } print $0; }
awk: cmd. line:1: ^ syntax error
Modified:
$ awk '{ if ($0 !~ /^>/) { gsub("-", "",$0); } print $0; }' test.fa
>seq-1-1
atgc
>seq2
gc
>seq_3
gatgatg
awk version:
$ awk --version
GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
input example fasta:
$ cat test.fa
>seq-1-1
a-t-g----c
>seq2
--g--c---
>seq_3
-gatga-tg
please post an example of what you mean "aligned sequences". FASTA as a format is not an alignment format, hence it is not clear what you are looking for
This is part of what my aligned fasta file contains:
Run it through
awkand delete-gap characters from the sequence string.