Sponsored Content
Top Forums Shell Programming and Scripting sed search and replace command Post 302280232 by janzper on Monday 26th of January 2009 10:27:07 AM
Old 01-26-2009
sed search and replace command

Hi,

I would like to seek help on how i can arrive on this result.

sample.txt:
product_code IN (param001) and product_type IN (param004)
product_code IN (param002) and product_type IN (param005)
product_code IN (param003) and product_type IN (param006)

I would like to change the param001 to 'RB23','J'

I tried this command in sed but it has error.

$ sed 's/param001/'RB23','J'/g' sample.txt > sample.out

output should be:
product_code IN ('RB23','J') and product_type IN (param004)

I am new to sed and it would be nice if you can help me on this. Thanks in advance.

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search and replace sed or tr

Hi folks, I need to search and replace specific text in a file and replace it. I have a text file that does not have any newlines or carriage returns. All newlines have been removed. Here is what I need to do. Find the exact string “DH” (quotes included) and replace it with \n”DH” (basically... (6 Replies)
Discussion started by: bridgeje
6 Replies

2. UNIX for Dummies Questions & Answers

sed search and replace

Hello Folks, Anyone know how I can replace this line in file.xml <oacore_nprocs oa_var="s_oacore_nprocs">8</oacore_nprocs> with this line <oacore_nprocs oa_var="s_oacore_nprocs">1</oacore_nprocs> using sed or awk ? Thanks for your time. Cheers, Dave (7 Replies)
Discussion started by: d__browne
7 Replies

3. UNIX for Dummies Questions & Answers

Search/Replace with Sed

Is there a way to use the sed command to 1) search a specified pattern 2) in the line where that pattern is found, replace from character N to character N+4 with a new 4-character string. Thks in advance! (5 Replies)
Discussion started by: mvalonso
5 Replies

4. UNIX for Dummies Questions & Answers

SED command to search for numeric and replace

Hi I am very new to linux and scripting. I need to replace numbers abc with number xyz inputting from a reference file. I used the following command - sed "s/$grd/$lab/" , where $grd and $lab comes from reference file. The problem is the above line doesnt take care of space..... (1 Reply)
Discussion started by: ajayh
1 Replies

5. UNIX for Dummies Questions & Answers

How to search and replace a particular line in file with sed command

Hello, I have a file and in that, I want to search for a aprticular word and then replace another word in the same line with something else. Example: In file abc.txt, there is a line <host oa_var="s_hostname">test</host> I want to search with s_hostname text and then replace test with... (2 Replies)
Discussion started by: sshah1001
2 Replies

6. Shell Programming and Scripting

sed search and replace

hi, im new for sed, anyone can help me to these in sed command my output file.txt "aaa",a1,bbb "ddd",a1,ccc "eee",a1,www need to change a1, to "a1"," output i need "aaa","a1","bbb "ddd","a1","ccc "eee","a1","www thanks in advance fsp (2 Replies)
Discussion started by: fspalero
2 Replies

7. UNIX for Dummies Questions & Answers

How to use 'sed' to search and replace?

Hello - I have a very large file in which a certain numbers are repeated. I find that using vi to edit the entire file is useless. How should i use sed to find a replace such as this text: To replace: 145.D25.D558 With: 215.22.45.DW I tried this command: sed... (4 Replies)
Discussion started by: DallasT
4 Replies

8. Shell Programming and Scripting

search and replace with sed command

hi, suggest me in the below script.. if In above I wanna replace "" with "]". (2 Replies)
Discussion started by: divya bandipotu
2 Replies

9. Shell Programming and Scripting

Need help with search and replace using SED

Hi guys, thanks for accepting me in your forum .. I am trying to clean some hacked PHP files using SSH .. I am using this command: find . -type f -print0 | xargs -0 sed -i '/god_mod/d' <?php ... (3 Replies)
Discussion started by: wisam74us
3 Replies

10. Shell Programming and Scripting

How to search and replace string in column in file with command sed?

how to search and replace string in column in file with command sed or other search "INC0000003.in" and replace column 4 = "W" $ cat file.txt INC0000001.in|20150120|Y|N|N INC0000002.in|20150120|Y|N|N INC0000003.in|20150120|Y|N|N INC0000004.in|20150120|Y|N|Noutput... (4 Replies)
Discussion started by: ppmanja3
4 Replies
gentapes(8)						      System Manager's Manual						       gentapes(8)

Name
       gentapes - produce distribution mag tape media

Syntax
       /usr/sys/dist/gentapes [-{wv}] [hostname:]product_code special

Description
       The  utility is used to produce MT9 or TK50 mag tape distribution media.  The utility searches for the product_code as provided by the user
       on the command line, plus the letters "TK" which is appended to the product code by the utility.  If  a	corresponding  kit  descriptor	is
       found  in  the  utility uses the information in the kit descriptor to copy files to the tape media mounted on tape drive special.  Once all
       files have been transferred, the tape is rewound and each file is verified by using the results of and comparing it to sums  given  in  the
       kit  image  file.   The utility can support multi-volume tape kits, and multiproduct tape kits.	See for information on how to set up these
       features.

       The optional hostname: is the name of a remote TCP/IP network machine that contains the kitcap file.  The utility will search on the remote
       machine for the product_code and use it for creating the media.	The colon (:) is a required delimiter for TCP/IP networks, and there is no
       space between the colon and the product_code.  For example, if the product code was ULT-2.2-V-BW, and the kitcap file to  be  used  was	on
       node "mynode", the proper syntax for this option would be
	    mynode:ULT-2.2-V-BW

       The  product_code  is  a  user  defined code that is located in and describes the partition, directories, and subsets that make up a kitcap
       description.  It can be any set of numbers or letters and is usually formed in a way to have some meaning relative to the product  that	it
       describes.  For example, if the product name is MYPRODUCT and it is version 1, the product_code might be MYP010.

       The special argument is used to specify a special device such as /dev/nrmt?l.

Options
       -w     Write only.

       -v     Verify only.

	      If neither option appears on the command line, the utility by default will write and then verify the files in the kit descriptor.

Restrictions
       You  must  be  a  superuser  to run this program.  If the optional hostname is used, you must be able to access files on the remote host as
       superuser.

Files
       ra device special files

       Kit descriptor database

See Also
       sum(1), kitcap(5), genra(8)

																       gentapes(8)
All times are GMT -4. The time now is 04:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy