Inside Out Outside In

Friday, February 8, 2019

KornShell: Replace spaces with underscores

A simple ksh that will replace a space with "_"


#!/bin/ksh
find /your/file/directory -type f -name "* *" | \
while read file; do \
newfile="$(echo "$file" | sed 's/ /_/g')"
mv "${file}" "${newfile}"
done
Posted by Christopher Wigginton at 11:24 AM No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: KornShell
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

About Me

My photo
Christopher Wigginton
View my complete profile

Where I Work

I'm a senior consultant at Gorilla Logic. Need ColdFusion development work? Let's Talk.

Tags

Oracle Node.js npm AngularJS Atom Blogger C# Call Centers ColdFusion Crystal Reports DataTables Free Garmin Google Domains JSONP JavaScript KornShell Live Preview Microsoft Mint KDE Navigation OnStar PL/SQL Pivot Programming SAP SMTP Server SQL Skype Sublime UFL backup debian eBook food jQuery jsbin security

Blog Archive

  • ▼  2019 (1)
    • ▼  February (1)
      • KornShell: Replace spaces with underscores
  • ►  2018 (3)
    • ►  November (1)
    • ►  August (1)
    • ►  January (1)
  • ►  2017 (2)
    • ►  August (2)
  • ►  2016 (12)
    • ►  April (6)
    • ►  March (6)

Things you may find interesting

  • Remington 870 Forum, Accessories, Upgrades Reviews
  • My GitHub Repo
Simple theme. Powered by Blogger.