Unix rename command for one character on filename [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have over 1,000 files that I will like to change one character on the filename, Ex: GM001001, GM001002, GM001003, etc.. to be rename to GX001001, GX001002, GX001003, etc... As you can see the common denominator will be the M to be replace for an X.

You can combine mv with string replace to achieve this:
for f in $(ls)
do
mv $f ${f/GM/GX}
done

Related

How to extract the file with same name from different directories in linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have lots of folders with the same file name, like:
fd1/01.wh.txt
ff2/01.wh.txt
fk2/01.wh.txt
fd3/01.wh.txt
I want to extract 01.wh.txt from these different directories, and get a new folder including all 01.wh.txt with the specific parent code:
new_folder/
fd1.01.wh.txt
ff2.01.wh.txt
fk2.01.wh.txt
fd3.01.wh.txt
How to execute the code in the Linux system?
Try this..
for i in find . -name "*.txt"; do echo $i; fname=echo $i|sed 's/\//-/g'; echo $fname; cp $i ./newdir/$fname; done

Delete file with # in Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I want to delete a #tem.txt# called # that for some reason using emacs appeared
is between two # and I have not been able to remove it using rm, rm -f, unlink
See my file
Since '#' is a special character, you can try rm \#tem.txt\#

how to rename files and thank you [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
how I can rename several files (Q0138-9061933666_S5.fasta.db) in a folder and leave only the no as ca (Q0138-9061933666_S5.db) i.e. delete .fasta from all files
Assuming you are in the folder where the files are placed.
for i in *.fasta.db
do
mv $i ${i/\.fasta/} # remove "fasta" from file name
done
See Replace one substring for another string in shell script for details about string substitution

How to copy one directory to many directory using Linux command? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
If I have a directory name '1' (without quotes) and want to copy that directory (with its contents) to many directories name '2' to '70', how do this using Linux commands?
so, each copy will only do once, but (in bash at least)
for x in $(seq 2 70); do cp -r 1 $x; done
should do it

How do I compare two directories while ignoring certain directory names? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I want to iteratively compare two directories, A and B, under Linux using:
diff -r ./A ./B
but I want to ignore some subdirectory names, e.g. a subdirectory called "svn".
How do I do it under Linux?
You can write:
diff -r --exclude=svn ./A ./B

Resources