Sponsored Content
Top Forums Shell Programming and Scripting Replacing string in multiple files Post 302352188 by arulanandsp on Thursday 10th of September 2009 04:02:19 PM
Old 09-10-2009
Replacing string in multiple files

Hi,

I need to replace the string 'abcd' with 'xyz' in a file sample.xml
This sample.xml is also present in the subdirectories of the current directory.

Eg,

If I am in /user/home/

the sample.xml if present in
/user/home/
/user/home/folder1/
/user/home/folder2/
/user/home/folder2/subfolder1/

I tried using
sed "s/abcd/xyz/g" sample.xml > temp; mv temp sample.xml;

But this replaces only the sample.xml in /user/home/ directory.

Please help on this
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replacing a string in all files in a dir

Hello guys, I need help in globally replacing a string 'string1' with 'string2' in several files in a directory. In fact, also in all directories under it. Can anyone help me... Thanks (3 Replies)
Discussion started by: chiru_h
3 Replies

2. Shell Programming and Scripting

Replacing string in files

Hi, I Have 10 files ,I need replace $INPUT_LOCATION with $INPUT_LOCATION_upd .using sed command do it single file .How can change all files in single shot instead of doing individual file sed -s'/old/new/g' file1 Thanks, Mohan (2 Replies)
Discussion started by: mohan705
2 Replies

3. Shell Programming and Scripting

renaming multiple files while replacing string

hi, i've found a few examples of scripts to do this but for some reason can't get them to work properly. basically i have some dirs with a few hundred files mixed in with a bunch of other files that were made with a typo in part of them. long-file-names-tyo-example.ext want to be able... (2 Replies)
Discussion started by: kevin9
2 Replies

4. Shell Programming and Scripting

replacing a string in multiple subdirs to a new string??

I have following set of dirs: /dir1/dir2/subdir1 file1 file2 /dir1/dir3/subdir1 file4 file5 /dir1/dir4/subdir1 file6 file7 All of these files have a common string in them say "STRING1", How can I... (3 Replies)
Discussion started by: Hangman2
3 Replies

5. Shell Programming and Scripting

Replacing text from multiple files at multiple location

Hi, I have many files scattered in all different folders. I want to replace the text within all the files using a single command ( awk, sed...) Is it possible? example find all the files in which there is text "memory" and replace it with "branded_memories". the files can be at the... (2 Replies)
Discussion started by: rudoraj
2 Replies

6. UNIX for Dummies Questions & Answers

best method of replacing multiple strings in multiple files - sed or awk? most simple preferred :)

Hi guys, say I have a few files in a directory (58 text files or somthing) each one contains mulitple strings that I wish to replace with other strings so in these 58 files I'm looking for say the following strings: JAM (replace with BUTTER) BREAD (replace with CRACKER) SCOOP (replace... (19 Replies)
Discussion started by: rich@ardz
19 Replies

7. Solaris

Replacing a string in a long list of files

I have a script that needs to read a file with a long list of /path/filenames - replace the name of the server in each file - and write the file to the same path with a date extension. This is the script that I have so far #!/bin/ksh umask 022 LIST=`scripts.list` for i in $LIST do ... (2 Replies)
Discussion started by: bjdamon
2 Replies

8. Shell Programming and Scripting

Replacing old TNS entries with New one in multiple files

I have requirement to replace old TNS entries with New one in multiple files. one file may contain more then one occurrence of tns. Example: Below is the one of occurrence in a current file(s). i am interested to replace only red part. <connection-pool name="Google_APP_CP"... (4 Replies)
Discussion started by: KDDubai333
4 Replies

9. Shell Programming and Scripting

sed parser behaving strange on replacing multiple words in multiple files

I have 4000 files like $cat clus_grp_seq10_g.phy 18 1002 anig_OJJ65951_1 ATGGTTTCGCAGCGTGATAGAGAATTGTTTAGGGATGATATTCGCTCGCGAGGAACGAAGCTCAATGCTGCCGAGCGCGAGAGTCTGCTAAGGCCATATCTGCCAGATCCGTCTGACCTTCCACGCAGGCCACTTCAGCGGCGCAAGAAGGTTCCTCG aver_OOF92921_1 ... (1 Reply)
Discussion started by: sammy777888
1 Replies

10. UNIX for Beginners Questions & Answers

Issue with search and replacing multiple items in multiple files

Im having an issue when trying to replace the first column with a new set of values in multiple files. The results from the following code only replaces the files with the last set of values in val.txt. I want to replace all the files with all the values. for date in {1..31} do for val in... (1 Reply)
Discussion started by: ncwxpanther
1 Replies
XGFCONFIG(1)						      General Commands Manual						      XGFCONFIG(1)

NAME
xgfconfig - configuration program for Xgridfit SYNOPSIS
xgfconfig options [list] DESCRIPTION
Xgfconfig selects XSLT processors and RELAX NG validators for Xgridfit to use; it can also be used to specify a new Xgridfit base direc- tory. Xgridfit maintains lists of validators and processors; on starting, it consults these lists and runs the first validator and processor it can find. Xgfconfig reorders these lists so that your preferred programs are looked for first. Xgfconfig may be invoked in one of these forms: $ xgfconfig --processors processor-list $ xgfconfig --validators validator-list $ xgfconfig --xgridfit-dir /xgridfit/directory $ xgfconfig --show The first of these selects processors (one or more of libxslt, lxml, xsltproc, saxon-6, saxon-9, xalan-j, xalan-c, 4xslt); the second selects validators (one or more of libxml2, lxml, jing, msv, rnv); the third specifies a complete path to the Xgridfit base directory (use it if you have installed Xgridfit in your own account rather than system wide); the fourth displays the current configuration. Several of the processors and validators that Xgridfit knows about are Java programs; for these, Xgridfit needs the name and location of a .jar file (by default it assumes certain standard file names, found in /usr/share/java). Specify this with a hash-mark followed by a com- plete path-name for the file. Here are sample command lines: $ xgfconfig -p saxon-9#/usr/local/share/java/saxon9he.jar lxml $ xgfconfig --config=config.xml -V rnv msv#/home/me/java/msv.jar The second of these commands stores the configuration in the file config.xml in the current directory. (When it starts, Xgridfit looks first for a file config.xml in the current directory; failing that, it looks for ~/.xgridfit/config.xml (Linux/Mac) or some-path (Windows); finally it looks in the Xgridfit base directory before giving up and using the default configuration.) An Xgridfit configuration file is a simple XML file, easily editable by users. The entries in it should be all but self-explanatory. OPTIONS
--config The configuration file to read or write. If this is not specified, Xgfconfig will search in the standard places (see above) for an existing configuration file for which the user has write privileges. Failing that, it will create a configuration file in the directory ~/.xgridfit (Linux/Mac) or some-dir (Windows). If the user is root or has administrative privileges, Xgfconfig will create the file in the Xgridfit base directory. -h, --help Display a help message and exit. -p, --processors The list following the options is a list of processors. -s, --show Display the current configuration and exit. -V, --validators The list following the options is a list of validators. -x, --xgridfit-dir Following the options is the full pathname of the Xgridfit base directory. SEE ALSO
fontforge(1), xgridfit(1), ttx2xgf(1), xgfupdate(1). AUTHOR
Xgfconfig was written by Peter Baker <psb6m@virginia.edu>. This manual page was written by Peter Baker 2010-01-16 XGFCONFIG(1)
All times are GMT -4. The time now is 02:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy