Last active
January 28, 2018 01:13
-
-
Save sagax/19e5e61509905632244a89c7b3c2095f to your computer and use it in GitHub Desktop.
to rename strange file name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls | awk '/\.webm$/{original=$0; split($0, s, ""); line=""; for(i in s){ if (s[i] ~ /([a-zA-Z0-9]|\s|\.|-)/) {line=line s[i]; }}; split(line, nline, "-"); oleft=nline[1]; left=nline[1]; right=nline[2]; left=tolower(left); sub(/^\s+/, "", left); sub(/(^\s+|\s+$)/, "", left); print original " >> " left"-"right }' | |
# example | |
# ► 1 HOUR CHILLSTEP MIX JANUARY 2015 ◄ ~( ̄▽ ̄)~-_0kAYDIyIyo.webm >> 1 hour chillstep mix january 2015-0kAYDIyIyo.webm | |
# ► 1 HOUR MELODIC DUBSTEP MIX JANUARY 2015 ◄ ~( ̄▽ ̄~)-Cd9hekSTYAE.webm >> 1 hour melodic dubstep mix january 2015-Cd9hekSTYAE.webm | |
# ► BEST OF CHIPTUNE MIX FEBRUARY 2015 ◄ ~( ̄▽ ̄)~-Ik7VvFDs9pw.webm >> best of chiptune mix february 2015-Ik7VvFDs9pw.webm | |
# ► BEST OF GLITCH HOP JANUARY 2015 ◄ (~ ̄▽ ̄)~-vu7YJGiiZX4.webm >> best of glitch hop january 2015-vu7YJGiiZX4.webm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment