Sponsored Content
Top Forums Shell Programming and Scripting Replace characters in all file names in a particular directory Post 99354 by madhunk on Thursday 16th of February 2006 01:33:07 PM
Old 02-16-2006
Replace characters in all file names in a particular directory

Hi,

I have searched the forum on how to mass replace the file names. We are doing the migration and I am trying to accomplish a task where I have to replace all UNIX scripts in a particular directory that start with bdw to fdm...

For example: bdw0110137.sh should be fdm0110137.sh

Keep the existing script bdw0110137.sh and the contents in it and also have another script fdm0110137.sh with the same contents. Just like copying it into another script but with 'fdm' in the beginning.

I tried using the cut command, and also tried to change the code I found in the forum.

I would appreciate if you could help me in this regard.

Thank You,
Madhu
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Weird Ascii characters in file names

Hi. I have files in my OS that has weird file names with not-conventional ascii characters. I would like to run them but I can't refer them. I know the ascii # of the problematic characters. I can't change their name since it belongs to a 3rd party program... but I want to run it. is there... (2 Replies)
Discussion started by: yamsin789
2 Replies

2. UNIX for Dummies Questions & Answers

Listing full file names with the exact length of 3 characters

This is what I have to do: Display the full file name (including the full path) and file size of all files whose name (excluding the path) is exactly 3 characters long. This is the code I have: find / -printf "Name: %f Path: %h Size: %s (bytes)\n" 2>/dev/null | grep -E "Name: .{3,} Path" |... (7 Replies)
Discussion started by: Joesgrrrl
7 Replies

3. UNIX for Dummies Questions & Answers

removing first 7 characters of directory names

Hi, I'm relatively new to unix, and would like to change the following files in a particular directory. The files have names like: M10_90_Phcn402_3F.ab1 M10_94_Sput402_3F.ab1 M11_92_Abrg402_3R.ab1 M10_91_Cdel402_3F.ab1 M11_90_Phcn402_3R.ab1 M12_84_Sput402_3R.ab1... (4 Replies)
Discussion started by: euspilapteryx
4 Replies

4. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

5. Shell Programming and Scripting

Finding File Names Ending In 3 Random Numerical Characters

Hi, I have a series of files (upwards of 500) the filename format is as follows CC10-1234P1999.WGS84.p190 each of this files is in a directory named for the file but excluding the extension. Now the last three numeric characters, in this case 999, can be anything from 001 to 999, I need to... (3 Replies)
Discussion started by: roche.j.mike
3 Replies

6. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

7. Shell Programming and Scripting

share a shell script which can replace weird characters in directory or file name

I just finish the shell script . This shell can replace weird characters (such as #$%^@!'"...) in file or directory name by "_" I spent long time on replacing apostrophe in file/directory name added: 2012-03-14 the 124th line (/usr/bin/perl -i -e "s#\'#\\'#g" /tmp/rpdir_level$i.tmp) is... (5 Replies)
Discussion started by: begonia
5 Replies

8. Tips and Tutorials

How to manage file names with special characters

One of the common questions asked are: how do i remove/move/rename files with special (non-printable) characters in their name? "Special" doesn't always mean the same. As there are more and less special characters, some solutions are presented, ranging from simple to very complicated. Usually a... (0 Replies)
Discussion started by: bakunin
0 Replies

9. UNIX for Dummies Questions & Answers

[solved]removing characters from a mass of file names

I found a closed thread that helped quite a bit. I tried adding the URL, but I can't because I don't have enough points... ? Modifying the syntax to remove ! ~ find . -type f -name '*~\!]*' | while IFS= read -r; do mv -- "$REPLY" "${REPLY//~\!]}"; done These messages are... (2 Replies)
Discussion started by: rabidphilbrick
2 Replies

10. UNIX for Dummies Questions & Answers

How to remove first few characters from multiple file names without do loop?

Hi Fellows, I was wondering how I can remove first few characters from multiple file names without do loop in unix? e.g. water123.xyz water456.xyz to 123.xyz 456.xyz Thanks Paul Thanks. (3 Replies)
Discussion started by: Paul Moghadam
3 Replies
DH_INSTALLINIT(1)						     Debhelper							 DH_INSTALLINIT(1)

NAME
dh_installinit - install upstart jobs or init scripts into package build directories SYNOPSIS
dh_installinit [debhelperoptions] [--name=name] [-n] [-R] [-r] [-d] [-O] [--params] DESCRIPTION
dh_installinit is a debhelper program that is responsible for installing upstart job files or init scripts with associated defaults files into package build directories, and in the former case providing compatibility handling for non-upstart systems. It also automatically generates the postinst and postrm and prerm commands needed to set up the symlinks in /etc/rc*.d/ and to start and stop the init scripts. FILES
debian/package.upstart If this exists, it is installed into etc/init/package.conf in the package build directory. debian/package.init Otherwise, if this exists, it is installed into etc/init.d/package in the package build directory. debian/package.default If this exists, it is installed into etc/default/package in the package build directory. OPTIONS
-n, --noscripts Do not modify postinst/postrm/prerm scripts. -o, --onlyscripts Only modify postinst/postrm/prerm scripts, do not actually install any init script, default files, or upstart job. May be useful if the init script or upstart job is shipped and/or installed by upstream in a way that doesn't make it easy to let dh_installinit find it. If no upstart job file is installed in the target directory when dh_installinit --onlyscripts is called, this program will assume that an init script is being installed and not provide the compatibility symlinks or upstart dependencies. -R, --restart-after-upgrade Do not stop the init script until after the package upgrade has been completed. This is different than the default behavior, which stops the script in the prerm, and starts it again in the postinst. This can be useful for daemons that should not have a possibly long downtime during upgrade. But you should make sure that the daemon will not get confused by the package being upgraded while it's running before using this option. -r, --no-restart-on-upgrade Do not stop init script on upgrade. --no-start Do not start the init script on install or upgrade, or stop it on removal. Only call update-rc.d. Useful for rcS scripts. -d, --remove-d Remove trailing d from the name of the package, and use the result for the filename the upstart job file is installed as in etc/init/ , or for the filename the init script is installed as in etc/init.d and the default file is installed as in etc/default/ . This may be useful for daemons with names ending in d. (Note: this takes precedence over the --init-script parameter described below.) -uparams --update-rcd-params=params -- params Pass params to update-rc.d(8). If not specified, defaults will be passed to update-rc.d(8). --name=name Install the upstart job file or the init script (and default file) using the filename name instead of the default filename, which is the package name. When this parameter is used, dh_installinit looks for and installs files named debian/package.name.upstart, debian/package.name.init and debian/package.name.default, instead of the usual debian/package.upstart, debian/package.init and debian/package.default. --init-script=scriptname Use scriptname as the filename the init script is installed as in etc/init.d/ (and also use it as the filename for the defaults file, if it is installed). If you use this parameter, dh_installinit will look to see if a file in the debian/ directory exists that looks like package.scriptname and if so will install it as the init script in preference to the files it normally installs. This parameter is deprecated, use the --name parameter instead. This parameter will be ignored completely for upstart jobs. --upstart-only Only install an upstart job file, and do not include maintainer script code to replace an init script with that upstart job. This parameter is intended for use when the "package.upstart" file is new and only to be used on Upstart-based systems. --error-handler=function Call the named shell function if running the init script fails. The function should be provided in the prerm and postinst scripts, before the #DEBHELPER# token. NOTES
Note that this command is not idempotent. dh_prep(1) should be called between invocations of this command. Otherwise, it may cause multiple instances of the same text to be added to maintainer scripts. SEE ALSO
debhelper(7) This program is a part of debhelper. AUTHORS
Joey Hess <joeyh@debian.org> Steve Langasek <steve.langasek@canonical.com> Scott James Remnant <scott@canonical.com> 8.9.0ubuntu2.1 2012-06-12 DH_INSTALLINIT(1)
All times are GMT -4. The time now is 09:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy