I have several files whose names aren't correct:
$ ls
devoirNote1_1_2.R devoirNote1_1_5.R devoirNote1_4_1.R
devoirNote1_1_3.R devoirNote1_1.R devoirNote1.R
devoirNote1_1_4.R devoirNote1_2_1.R example140.R
I want to change all devoirNote1_i_j.R with the i and j integers except devoirNote1_4_1.R to devoirNote1_{i+1}_j.R (only devoirNote1_4_1.R is left unchanged).
I thought of using the command mvlike mv devoirNote1_*_2.R devoirNote1_2_2.R but when several files match (for example if both devoirNote1_1_2.R and devoirNote1_3_2.R are present), it creates an issue.
Therefore, how to create a script or a command line that renames my files, by incrementing one of the variables in the filenames, but not all of them?
devoirNote1_1_2.R? – ilkkachu Mar 25 '17 at 15:33devoirNote1_1_2.Rwith a 1 in the middle. Same fordevoirNote1_2_1.R. Do you meandevoirNote1_1_*anddevoirNote1_2_*respectively? Please clarify your question. – xhienne Mar 25 '17 at 17:02devoirNote1_i_2.R. The way your problem is stated, all you have to do ismv devoirNote1_1_2.R devoirNote1_2_2.R. Only one command. Why is it a problem? Why do you need a script for this? Please clarify and provide us with the expectedlsoutput after the move(s). – xhienne Mar 25 '17 at 17:30devoirNote1_4_1.Rin this case? – lgeorget Mar 25 '17 at 22:30