Skip to content

Tag: file-rename

awk renamed few files and left few to renamed

I am trying to replace part of filenames based on matching string of filename from another file. Filenames are in following format: where digits before first _ represent station code, which I want to replace with its station name from another file named radiosonde.csv. For example : I want change 36872_201908…

Modification of file names

I have a list of more than 1000 files on the following format. I am on Linux and want to change them as follows Using rename and awk I managed to get The remaining task is now to remove the last field that holds the year. Answer A solution that uses sed to generate the new names and the rename

Bash oneliner to rename filenames

I often would like to easily rename a bunch of files. I always have to struggle with find, grep, xargs and sed to simply to the job. I would like to understand how I can do a better job using PCRE Here my files: I would rename the dot files properly as I can do with this oneliner: However I

How to uppercase file name but exclude extension

Is it possible to use rename to uppercase a file but exclude its extension? ie: I want to rename the file foo_bar.ext to FOO_BAR.ext I tried with rename ‘y/a-z/A-Z/’ foo_bar.ext, but the whole file (including extension) gets uppercased FOO_BAR.EXT Answer You are asking rename to convert all the in…

Is rename() atomic?

I am not being able to check this via experiments and could not gather it from the man pages as well. Say I have two processes, one moving(rename) file1 from directory1 to directory2. Say the other process running concurrently copies the contents of directory1 and directory2 to another location. Is it possibl…