Sponsored Content
Full Discussion: Global replace with sed
Top Forums Shell Programming and Scripting Global replace with sed Post 302195537 by danmero on Thursday 15th of May 2008 10:19:45 AM
Old 05-15-2008
Use a temp file.
Code:
 find . -name "*.txt" -type f -exec sed 's/ugly/bad/g' {} > tmp \; -exec mv tmp {} \;

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Global search ok...but replace?

Gurus, I have in my /tmp directory 26 files "filea", "fileb"..."filez". Each file contains the name of a database 'dwora' at many, many places within each file. My boss decided to change the name of the db so I need to do (what i'd call) a global search&replace of that string in all my... (0 Replies)
Discussion started by: alan
0 Replies

2. Shell Programming and Scripting

global replace...

Hi, I have a dir containing many shell scripts. Each of these shell scripts state a database name (always the same), which I need to change to be a new database. grep <database name> * brings back all the lines containing the database name. However, I need to change them to be something... (1 Reply)
Discussion started by: topcat8
1 Replies

3. Shell Programming and Scripting

Perl: Global Search and replace

I have a file where the rows correspond to individuals and the columns are about 106 variables. Each variable is coded as either ACGT, and "missing" is coded as blank. This is a tab delimited file. I'm trying to replace all blanks (" ") with 0. The simple script I have is only replacing some of the... (3 Replies)
Discussion started by: epi8
3 Replies

4. Shell Programming and Scripting

Need an awk for a global find/replace in a file, specific column

I am new to unix and awk/sed etc... using C-Shell. Basically, I have a fixed length file that has 4 different record types on it, H, D, V, W all in column 1. I need to change all the W's in column 1 to D's. in the entire file. The W's can be anywhere in the file and must remain in the same... (3 Replies)
Discussion started by: jclanc8
3 Replies

5. Shell Programming and Scripting

Global search and replace across multiple files

Hi all I'm in need of a command which can replace a specified string with another string - across multiple files within multiple sub-directories (I intend to run it from / ) I've used the following to get a list of the files: find . | xargs grep <string1> But that's as far as I've got.... (7 Replies)
Discussion started by: huskie69
7 Replies

6. Shell Programming and Scripting

Global replace in vi with no escape required

Hi all, I want to replace a string of words but i dont want to worry about escaping the characters in that string . For e.g. If my string is "work/" and i want to replace it with "nowork" .I have to type %s/work\//nowork/g Is there a way by which I wont need to worry about the data in... (1 Reply)
Discussion started by: sachinpawar2308
1 Replies

7. Shell Programming and Scripting

Global search and replace multi line file

Hello I need to search for a mult-line strngs(with spaces in between and qoted) in a file1 and replace that text with Fixed string globally in file1. The strng to search for is in file2. The file is big with some 20K records. so speed and effciency is required file1: (where srch & rplc... (0 Replies)
Discussion started by: Hiano
0 Replies

8. UNIX for Dummies Questions & Answers

Vi global replace command

I am wondering what way, I can remove a certain text with nothing. for example: MyVariable=Y7UHNI to only: Y7UHNI removing 'MyVariable=' globally? thanks (1 Reply)
Discussion started by: DallasT
1 Replies

9. Shell Programming and Scripting

Global replace with perl in bash

I am newbie to perl, I am trying to use the below syntax to replace globally a string with a variable. $ bash -version GNU bash, version 2.05b.0(1)-release (powerpc-ibm-aix5.1) Copyright (C) 2002 Free Software Foundation, Inc. $ perl -version This is perl, v5.8.8 built for... (2 Replies)
Discussion started by: jville
2 Replies

10. UNIX for Dummies Questions & Answers

Global replace command help

Hello - I am trying to use a global replace command but its not working. Here is the cmd I am using in vi: :%s/OLD/NEW/g However, in my "NEW" I already have a "/" which is not making the replace work: :%s/mytestscript.com:33232/mytestscript:70245/test.com/g the... (2 Replies)
Discussion started by: DallasT
2 Replies
DH_INSTALL(1)							     Debhelper							     DH_INSTALL(1)

NAME
       dh_install - install files into package build directories

SYNOPSIS
       dh_install [-Xitem] [--autodest] [--sourcedir=dir] [debhelperoptions] [file|dir...destdir]

DESCRIPTION
       dh_install is a debhelper program that handles installing files into package build directories. There are many dh_install* commands that
       handle installing specific types of files such as documentation, examples, man pages, and so on, and they should be used when possible as
       they often have extra intelligence for those particular tasks. dh_install, then, is useful for installing everything else, for which no
       particular intelligence is needed. It is a replacement for the old dh_movefiles command.

       This program may be used in one of two ways. If you just have a file or two that the upstream Makefile does not install for you, you can
       run dh_install on them to move them into place. On the other hand, maybe you have a large package that builds multiple binary packages. You
       can use the upstream Makefile to install it all into debian/tmp, and then use dh_install to copy directories and files from there into the
       proper package build directories.

       From debhelper compatibility level 7 on, dh_install will fall back to looking in debian/tmp for files, if it does not find them in the
       current directory (or wherever you've told it to look using --sourcedir).

FILES
       debian/package.install
	   List the files to install into each package and the directory they should be installed to. The format is a set of lines, where each
	   line lists a file or files to install, and at the end of the line tells the directory it should be installed in. The name of the files
	   (or directories) to install should be given relative to the current directory, while the installation directory is given relative to
	   the package build directory. You may use wildcards in the names of the files to install.

	   Note that if you list exactly one filename or wildcard-pattern on a line by itself, with no explicit destination, then dh_install will
	   automatically guess the destination to use, the same as if the --autodest option were used.

       debian/not-installed
	   Used with the deprecated --list-missing and --fail-missing options.	Please refer to dh_missing(1) for the documentation of this file.

OPTIONS
       --list-missing
	   Deprecated: Please use dh_missing --list-missing instead.  If you use this option, dh_install will call dh_missing with that option
	   after it has processed all the files.  Please see dh_missing(1) for the documentation of this option.

	   This option is removed in compat 12.

       --fail-missing
	   Deprecated: Please use dh_missing --fail-missing instead.  If you use this option, dh_install will call dh_missing with that option
	   after it has processed all the files.  Please see dh_missing(1) for the documentation of this option.

	   This option is removed in compat 12.

       --sourcedir=dir
	   Look in the specified directory for files to be installed.

	   Note that this is not the same as the --sourcedirectory option used by the dh_auto_* commands. You rarely need to use this option,
	   since dh_install automatically looks for files in debian/tmp in debhelper compatibility level 7 and above.

       --autodest
	   Guess as the destination directory to install things to. If this is specified, you should not list destination directories in
	   debian/package.install files or on the command line. Instead, dh_install will guess as follows:

	   Strip off debian/tmp (or the sourcedir if one is given) from the front of the filename, if it is present, and install into the dirname
	   of the filename. So if the filename is debian/tmp/usr/bin, then that directory will be copied to debian/package/usr/. If the filename
	   is debian/tmp/etc/passwd, it will be copied to debian/package/etc/.

       file|dir ... destdir
	   Lists files (or directories) to install and where to install them to.  The files will be installed into the first package dh_install
	   acts on.

LIMITATIONS
       dh_install cannot rename files or directories, it can only install them with the names they already have into wherever you want in the
       package build tree.

       However, renaming can be achieved by using dh-exec with compatibility level 9 or later.	An example debian/package.install file using dh-
       exec could look like:

	#!/usr/bin/dh-exec
	debian/default.conf => /etc/my-package/start.conf

       Please remember the following three things:

       o   The package must be using compatibility level 9 or later (see debhelper(7))

       o   The package will need a build-dependency on dh-exec.

       o   The install file must be marked as executable.

SEE ALSO
       debhelper(7)

       This program is a part of debhelper.

AUTHOR
       Joey Hess <joeyh@debian.org>

11.1.6ubuntu2							    2018-05-10							     DH_INSTALL(1)
All times are GMT -4. The time now is 06:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy