This should be a basic question for many people, but I'm a biologist with no programming, so please excuse my question.
What I'm trying to do is rename about 100,000 gzipped data files that have an existing code name (example: XG453834.fasta.gz). I would like to call them easy to read and analyze by me (example: Xanthomonas_galactus_str_453.fasta.gz).
I tried to use sed , rename and mmv to no avail. If I use any of these commands in a one-time script, then they work fine, just when I try to include variables in a shell script, I run into problems. I am not getting any errors, just the names are not changed, so I suspect this is an I / O error.
This is what my files look like:
#! /bin/bash
... and here are the first lines of my txt file with a single space separator:
cat names.txt #find #replace code1 name1 code2 name2 code3 name3
I know that I can do this with python or perl, but since I'm stuck here working on this particular script, I want to find a simple solution to fix this bash script and find out what I am doing wrong. Thanks so much for any help.
Also, I tried the cat name file (see comment from Ashoka Lella below) and then use awk to move / rename. Some of the files have variable names (but always begin with code), so I'm looking for a search and replace option to just replace the "code" with the "name" and keep the file name structure.
I suspect that I am not avoiding the variable within the same tick of the perl expression, but I have typed a lot of guides and I cannot find a way to do this.