Linux bash script removing specific string from filename and everything afterwards while keeping everything before string intact.

1000+ files all in the same folder that need renaming.


[login to view URL] > [login to view URL]

[login to view URL] [login to view URL] > [login to view URL] [login to view URL]

even morerandom-Danish [login to view URL] > even [login to view URL]

[login to view URL] > [login to view URL]

more random DANISH even more [login to view URL] > more [login to view URL]

As the Examples above the trigger word is always "Danish" that very in upper and lower case. Also sometimes a sign or space just before "Danish" need to be removed so files wont end up like random2..avi, [login to view URL] or random2 .avi

If "Danish" missing from filename ill like the script to check for the following instead and also delete everything afterwards, but unlike danish keep the season, episode or date and again everything before intact:









The above can of cause vary depending on the season, episode or date. If Danish or the above is missing, skip the file.

Skills: Linux, Regular Expressions, Ubuntu

See more: mysql linux bash script, linux ftp client bash script, linux bash script delete, sed, remove part of filename linux, sed remove everything before last occurrence of character, how to cut a string after a specific character in unix, how to cut a string before a specific character in unix, bash sed, awk remove everything before character, bash remove everything before last slash, linux bash script process apache access log, linux bash script sample sed, linux bash script log, linux bash script ftp, linux bash script installer mysql, linux bash script argument pass, linux bash script insert_record sh, linux bash script message day, linux bash script sed examples

About the Employer:
( 0 reviews ) Gråsten, Denmark

Project ID: #17936857

Awarded to:


hi, This kind of string pattern matching should be using Perl to do. I can give your a final utility scrip like: [login to view URL] [DIR].# If you don't give a dir, it will scan the $PWD - current dir. I can draft a sc More

€29 EUR in 1 day
(10 Reviews)

2 freelancers are bidding on average €26 for this job


- Shell scripting experience in Linux environment. - Practices of Software engineering methodologies - Knowledge & experience in Software quality, Testing & evaluation

€23 EUR in 1 day
(0 Reviews)