I am trying to capture file names by deleting both the file extension and the suffix, for example:
TEST_EXAMPLE_SUFFIX.file
Output = TEST_EXAMPLE
I want to do this based on matching the _SUFFIX part and extracting all the characters before that (not counting _SUFFIX). Normally I would use something like:
FILE_EXT=_SUFFIX
/.+?(?=$FILE_EXT)/
However, when pipelines that together are part of the for loop:
for t in $(ls *.fastq | sed -e /.+?(?=$READ1_EXT)/)
I get an error message:
command substitution: line 14: syntax error near unexpected token `('
What did I do wrong?
source
share