Renaming multiple files using sed


















Gregory Patmore Gregory Patmore 1 1 silver badge 4 4 bronze badges. Explaining how it solves the problem would improve the usefulness and long-term value of the answer. Ezra Citron Ezra Citron 11 1 1 bronze badge.

See unix. And by the way, CentOS 5. The outdated OS is at work and so it isn't up to me to upgrade : but a new cluster is being built out and presumably we'll upgrade when we move over I'd really like the last part as well.

But rename does not have the -d option as far as I can see Link — Klinghust. Kalana Kalana 4 4 bronze badges. Julie Pelletier 7, 1 1 gold badge 18 18 silver badges 41 41 bronze badges. Sajna T Sajna T 1. If you really think this could answer the question please add some explanation to your answer. Of itself, it only installs a package. You should explain what the command does and provide an example that handles the OP's specific requirement. Sign up or log in Sign up using Google. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Learn more. Rename multiple files with sed Ask Question. Asked 8 years, 7 months ago. Active 5 years ago. Viewed 13k times. Improve this question. Fredrik Pihl See related question stackoverflow. Add a comment. Active Oldest Votes. No need for sed, try this:! Improve this answer. Registered User. Join Date: Mar Hi all, I created file like this AAb. I want to end up with this: b.

Last edited by anishkumarv; at PM.. Reason: reason. Administrator Emeritus. Join Date: Jun Code :. Hi scottn, Code :. Reason: forget to put code tag. Renaming multiple files in sftp server in a get files script.

Hi, In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this? The image renaming example at the beginning of this page can be now be solved. First, I can list the files in the directory:. Here are some altnative methods that I have used in the past, each with a few weaknesses that need to be taken into account.

I want to document them here because they are instructive. This technique has some caveats. The first is that since it does not work with file names with spaces. The second is that since sed replaces the second instance of foo in a line, it does not handle the case where the file name had multiple instances of foo in the first place.

The second foo is replaced with bar , which is not what you want. Thus, this technique does not work when there is more than one instance of the word you want to replace in the filename.



0コメント

  • 1000 / 1000