Fabiuz99 Fabiuz99 - 1 year ago 92
Linux Question

Link separated words

I would know if there is a program or a script that can link separated words in a file name with a dot (or other punctuation marks).
How are you.pdf >>> How.are.you.pdf

I did not explain myself well, I'm looking for a bash script that can rename file names

Answer Source

Assuming you have How are you.pdf in a variable you can use parameter expansions:

% a="How are you.pdf"
% echo "${a// /.}"

The above is a bash expansion and doesn't work in a POSIX shell. In that case sed or simulare would be needed.

To rename all files in the current directory:

for a in *; do
  [ -f "$a" ] || continue
  mv -- "$a" "${a// /.}"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download