Sponsored Content
Top Forums Shell Programming and Scripting SED multiple find and replace Post 302576605 by uvrakesh on Friday 25th of November 2011 10:10:48 AM
Old 11-25-2011
as per my understanding if you are looking for multiple replacement and change in a single command this shall work
sed -e "s/cat/lion/g" -e "s/yes/no/g' -e 's/true/false/g' -e ....... -i.backup actual_file

will do all the replacement and keep a backup of your file, named actual_file.backup

offcourse its up to you, how good you are able to write the regular expression, more accurate less errors and surprises, but it will be fun, welcome to sed
its tricky first time, try to keep a backup manually :-)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed find and replace multiple lines

I am new to linux and would like to modify the contents of a file preferably using a one line. The situation is as follows <start> some lines "I am the string" "replace string" more lines here <end> In the above example,On encountering "I am the string", the "replace string "should be... (6 Replies)
Discussion started by: supersimha
6 Replies

2. Shell Programming and Scripting

Help with find and Replace using sed

I have to update a paramater (dateMemLimit) present in a file, with a date (YYYYMMDD) equal to 5 days before the sysdate. The parameter will be in the following format. dateMemLimit = 20091201 Please note the blank spaces present between 'dateMemLimit' &'=' and between '='... (4 Replies)
Discussion started by: rajesh8s
4 Replies

3. Shell Programming and Scripting

sed multiple replace

Hello! I'm using sed to perform a lots of replaces in one text file. I call it this way: sed -f commands.txt in.txt > out.txt commands.txt has about 1000 lines, each one is some variation of: s/from/to/gI And in.txt has about 300 000 lines. So the problem is that operation takes about... (7 Replies)
Discussion started by: backdrift
7 Replies

4. Shell Programming and Scripting

Find and replace multiple lines

I have a section of text in file A, see below # falkdjf lkjadf lkjadf lkajdf lkajdf lkajdf lkjadf lkjadf 234.234.2.234 lkjlkjlk 234.234.3.234 # Only the first line with "# falkdjf lkjadf lkjadf" is unique in the file. The new section that I want to overwrite the old section above is in... (1 Reply)
Discussion started by: jyang72211
1 Replies

5. Shell Programming and Scripting

Script to find & replace a multiple lines string across multiple php files and subdirectories

Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ? The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories. So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Discussion started by: spfc_dmt
12 Replies

6. Shell Programming and Scripting

using sed to find and replace multiple numbers

I have looked around and there are several examples of how to use sed, but I don't think any of them help me very much with what I am trying to do. I have a text file like this.... 1! SRCNAM = 00001 ! 1! X = 50.0000, 0.0000,... (10 Replies)
Discussion started by: mercury.int
10 Replies

7. Shell Programming and Scripting

Replace multiple lines through sed

Hi All, I have a input file as sample below <this is not starting of file> record line1 line2 line3 end line4 line5 record line6 line7 line8 my requirement is this, i want to select a pattern between first record and end, whatever is written between first record and end. and... (0 Replies)
Discussion started by: adgangwar
0 Replies

8. Shell Programming and Scripting

find and replace - multiple combinations

Hello all, I'm trying to replace all possible combinations of specific character occurrences within a string with another character, that is: For the following string: ABCAACD I want to replace all the possible combinations of the character 'A' with the character 'G', so the output... (3 Replies)
Discussion started by: hagit
3 Replies

9. Shell Programming and Scripting

Find and replace in multiple files

Hi, I have php files in main dir and sub dir's as well. I need to find "new mysqli('localhost', 'System', 'xxxxxx', 'System', '3306');" and replace as "new mysqli('localhost', 'unx_sys', 'yyyy', 'unx_sys', '3306');" I tried like: sed 's/new mysqli\(*\)\;$/new... (1 Reply)
Discussion started by: ashokvpp
1 Replies

10. UNIX for Beginners Questions & Answers

Find and replace from multiple files

Hello everybody, I need your help. I have a php site that was expoited, the hacker has injected into many php files a phishing code that was discovered and removed in order to have again a clean code. Now we need to remove from many php files that malware. I need to create a script that find and... (2 Replies)
Discussion started by: ninocap
2 Replies
BACKUP_HELP(8)						       AFS Command Reference						    BACKUP_HELP(8)

NAME
       backup_help - Displays help for backup commands

SYNOPSIS
       backup help [-topic <help string>+] [-admin] [-help]

       backup h [-t <help string>+] [-a] [-h]

DESCRIPTION
       The backup help command displays the complete online help entry (short description and syntax statement) for each operation code specified
       by the -topic argument. If the -topic argument is omitted, the output includes the first line (name and short description) of the online
       help entry for every backup command.

       To list every backup command whose name or short description includes a specified keyword, use the backup apropos command.

OPTIONS
       -topic <help string>+
	   Indicates each command for which to display the complete online help entry. Omit the backup part of the command name, providing only
	   the operation code (for example, specify dump, not backup dump). If this argument is omitted, the output briefly describes every backup
	   command.

       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       The online help entry for each backup command consists of the following two or three lines:

       o   The first line names the command and briefly describes its function.

       o   The second line lists aliases for the command, if any.

       o   The final line, which begins with the string "Usage", lists the command's options in the prescribed order. Online help entries use the
	   same symbols (for example, brackets) as the reference pages in this document.

EXAMPLES
       The following example displays the online help entry for the backup dump command:

	  % backup help dump
	  backup dump: start dump
	  Usage: backup dump -volumeset <volume set name> -dump <dump level name>
	  [-portoffset <TC port offset>]  [-at <Date/time to start dump>+]
	  [-append]  [-n]  [-file <load file>]	[-help]

PRIVILEGE REQUIRED
       None

SEE ALSO
       backup(8), backup_apropos(8)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26							    BACKUP_HELP(8)
All times are GMT -4. The time now is 07:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy