this post was submitted on 25 Jun 2023
0 points (50.0% liked)

Linux

8358 readers
240 users here now

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you're a seasoned Linux enthusiast or just starting your journey, we're excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let's dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

founded 2 years ago
MODERATORS
 

I recently purchased, ripped, and almost finished transcoding the entire series of Friends. I'm currently in the process of converting subtitles with Subtitle Edit. I'd like to save myself a bit of work by taking the last 13-14 characters off the ends of the file names.

For example, I'd like to take track13[spa] off of the following filename: 03x10 - The One Where Rachel Quits_track13_[spa].sup

Or is this not possible with Nautilus?

top 4 comments
sorted by: hot top controversial new old
[–] ictinus 2 points 2 years ago* (last edited 2 years ago) (1 children)

Assuming all but the number is the same in all file names, try this in a folder with a test file first....

rename 's/_track\d*_\[spa\]//' *

[–] MrGeekman 2 points 2 years ago* (last edited 2 years ago)

Thank you! I noodled around with that in a GUI program called GPRename and found a workable solution I just had to modify yours a bit to make it work there. Here's the finished solution, at least when using a graphical program like GPRename: _track\d*_\[eng\] *

[–] zikk_transport2 1 points 2 years ago

Try asking chatgpt to write such bash script. Of you are not good at bash - ask to tell how to execute it too.

[–] oceanus_ursus 1 points 2 years ago

This is something I'd probably do with a shell script. You can do it in a few intermediate stages. I'd start with putting together a script to dump the filenames to a text file and then some sed and awk to process that down to the final names. You could basically write a script to generate a script that you could inspect to see if it was correct before running it.