![]() For example: 5891_1_0_ad3884_ACTCTCGA_S10.bamįor the final result its ok if they are all capitalized (AD): AD3884.bamīut I need to be able to recognize upper and lowercase (case-insensitive) in the input. One additional issue is that the AD may also be lowercase (ad). dessert at 6:47 dessert What about 'rename any file starting with '1' to the same thing except starting with 2. Unfortunately the question got closed so that I cant add another answer for that. I was able to make the solution from Fit work with the following modifications: for file in * To do it dynamically, use rename s/ 0-9/&+1/e file instead, this will increase the number at the beginning of the filename by one. The rename solution from works perfectly. sed, awk, grep, or lastly rename solutions are also possible, though I have tried many versions of these without success. Ideally a bash solution from parameter expansion would be great (working in a Linux Ubuntu environment), though I have tried this without success. ![]() Currently there are always 4 digits following the AD, but in the future it may increase to 5. The number of underscores ("_") before and after the AD**** is not always consistent. I would like to remove everything except AD**** so that the resulting filenames would be: AD3884.bam I used directly these lines in my shell script to rename the file. ![]() I have multiple files I need to rename as below: 5891_1_0_AD3884_ACTCTCGA_S10.bam ![]()
0 Comments
Leave a Reply. |