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). I was able to make the solution from Fit work with the following modifications: for file in * 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. This takes every file in the current directory and renames it with a number with 14 digits (I hope I counted correctly) followed by 1.jpg. I would like to remove everything except AD**** so that the resulting filenames would be: AD3884.bam I have multiple files I need to rename as below: 5891_1_0_AD3884_ACTCTCGA_S10.bam To use mv to rename a file type mv, a space, the name of the file, a space, and the new name you wish the file to have.
0 Comments
Leave a Reply. |