0

I need to replace every instance of the word "Genus" in multiple files for their respective file name.

Tried listing every file name and then using

for line in `cat list_ids`; do sed 's/Genus/$line/g' $line; done

but it returned "$line" instead of the respective file name

  • just a list of file names – hola Jun 12 at 15:22
1

Your use of single quotes prevented variable expansion. Use double quotes:

for line in `cat list_ids`; do sed "s/Genus/$line/g" $line; done
  • Worked. Thanks! – hola Jun 12 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.