On 8/10/19 12:08 am, Andrew Greig via luv-main wrote:


On 7/10/19 8:37 pm, Andrew McGlashan via luv-main wrote:
for x in 6H9*;do mv -v "${x}" "${x/H/J}";done


Hi Andrew,
That is a very elegant one liner. So this one just changed the H to a J

Let's see if some light is entering the brain at this late hour
So this - for x in 6H9* - is saying for the input 6H9* (all files in the
directory with 6H9as a prefix) then do the exchange of the J for the H
using the move command mv  which is another way to rename;   -v for
verbose will print the outcome on screen and after that it looks like
the swap but I am lost from this point. But grateful.

Fix missing " chars....


So, in plain bash for your data files, it could be as simple as follows:

for x in *H*;do mv -vi "${x}" "${x/H/J}";done

and to reverse the changes:

for x in *J*;do mv -vi "${x}" "${x/J/H}";done


A.