Solved

script to replace spaces in file names with dash or underscore.

Posted on 2000-04-27
1
1,554 Views
Last Modified: 2013-12-06
I'm using HP-UX. I have a whole directory of several files imported from NT with spaces in the file names.
I need a script to change the all the spaces in the file names to underscore.

example:

fig 3-23 11 of 14.tif  to  fig_3-23_11_of_14.tif

0
Comment
Question by:RobbManess
1 Comment
 
LVL 20

Accepted Solution

by:
tfewster earned 50 total points
Comment Utility
Create a little shell script in the directory, e.g. "rs.sh", like so:

mv "$1" `echo $1 | tr " " "_"`

Execute this in the directory with:
find . -name "*.tif" -exec ./rs.sh {} \;



0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now