Batch remove whitespace in all the files in directory and replace with a dash "-"

/ Published in: Bash
Save to your folder(s)

Add this to your .profile or .bash_rc file, source the file, navigate to the directory and call "rm_whitespace"

Based on:

Copy this code and paste it in your HTML
  1. alias rm_whitespace="for F in * ; do NF=\`echo \$F | perl -lne \"s/ /-/g; s/\_/-/g; s/[,']//g; s/[-]+/-/g; print\"\` ; mv \"\$F\" \"\$NF\" ; done"


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.