Sponsored Content
Full Discussion: Replace Text
Top Forums UNIX for Dummies Questions & Answers Replace Text Post 73348 by deep.singh on Tuesday 31st of May 2005 10:58:45 AM
Old 05-31-2005
Replace Text

I have i/p file with following text -->
456 StreetA Rd (702) 456-7890
123 StreetB Rd 345-5678
789 StreetC Rd 123-8765
356 StreetD Rd (702) 657-3456


I want o/p file like below -->
456 StreetA Rd (702) 456-7890
123 StreetB Rd (702) 345-5678
789 StreetC Rd (702) 123-8765
356 StreetD Rd (702) 657-3456

Basically If text "(702)" is missing in each line, then i want to append (702) after text 'Rd '
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

search and replace a specific text in text file?

I have a text file with following content (3 lines) filename : output.txt first line:12/12/2008 second line:12/12/2008 third line:Y I would like to know how we can replace 'Y' with 'N' in the 3rd line keeping 1st and 2nd lines same as what it was before. I tried using cat output.txt... (4 Replies)
Discussion started by: santosham
4 Replies

2. UNIX for Advanced & Expert Users

Replace the text between two lines with different text

I have a file which contains the following data. Parameters "CParameters" BEGIN DSSUBRECORD Name "TgtDB" Prompt "TgtDB" Default "edwdev" ParamType "0" ParamLength "0" ParamScale "0" END DSSUBRECORD MetaBag... (6 Replies)
Discussion started by: ukatru
6 Replies

3. Shell Programming and Scripting

find text but replace a text beside it

I have an html file that looks like this (this is just a part of the html file): <td colspan="3" rowspan="1" style="text-align: center; background-color: rgb(<!-- IDENTIFIER1 -->51, 255, 51);"><small><!-- IDENTIFIER2 -->UP</small></td> This is to automatically update the status of the... (4 Replies)
Discussion started by: The One
4 Replies

4. Shell Programming and Scripting

How to replace text in a file with text entered

I am trying to write a shell script that will allow the typing of a value, then using that value to replace data in a text file. I suspect I need sed. The format of the file is: Variable1:Value1 Variable2:Value2 The interaction would be something like: Shell Prompt: "Please enter the... (9 Replies)
Discussion started by: cleanden
9 Replies

5. Shell Programming and Scripting

replace text

What command can I use to replace the last part of a text string with different text. Example: I want to replace the text NAME in the following string with the text NEW_NAME abc~diff~other~something~NAME The number of ~ can change. (4 Replies)
Discussion started by: jody325
4 Replies

6. Shell Programming and Scripting

Find and add/replace text in text files

Hi. I would like to have experts help on below action. I have text files in which page nubmers exists in form like PAGE : 1 PAGE : 2 PAGE : 3 and so on there is other text too. I would like to know is it possible to check the last occurance of Page... (6 Replies)
Discussion started by: lodhi1978
6 Replies

7. UNIX for Dummies Questions & Answers

Replace text

Hi, I have 50 shells in a particular directory. In each shell, we have a variable MAIL_SUCCESS=abc@xyz.com,def@xyz.com,emi@xyz.com The variable could be different. Now my requirement is I've to replace abc with def in all the shells present. I have been able to get the command for that: ... (3 Replies)
Discussion started by: donisback
3 Replies

8. UNIX for Dummies Questions & Answers

replace text

Hello I'm trying to replace in a text file the chain by 107,192,196,207 107.207 but I can not I tried the following cat translator_swift.properties.in_modif | sed 's/107\,207/107,192,196,207/g' > translator_swift.properties.in_modif Can you help me? thanks (8 Replies)
Discussion started by: nonanov
8 Replies

9. UNIX for Advanced & Expert Users

Search and replace text

HI I have property files having content QA_server_name=10.232.54.7 QA_port_number=18000 DEV_server_name=10.235.60.73 DEV_port_number=18000 and a .jason file having content like this { "server":"localhost" "port":"17000" ------ } I will get the parameter... (1 Reply)
Discussion started by: mdtausifsh
1 Replies

10. Shell Programming and Scripting

Exact Text Replace

I am currently working with a bash script to change some names around in 3 files. I am attempting to do this with sed but I haven't been able to get it so it won't replace partial matches. Below is an example of the files I am trying to edit. My main goal is to replace foo with test, but I... (4 Replies)
Discussion started by: Takau
4 Replies
cdrestore(1)															      cdrestore(1)

NAME
cdrestore - Streaming restore from CD-R(W)/DVD-R(W) SYNOPSIS
cdrestore [-qvDFRTV] [-d device] [-i image] [-l size] [-t track] [-c command] DESCRIPTION
cdrestore is a utility to make streaming restores from CD-R(W)/DVD-R(W) disks. It's designed to work with any backup tool which is able to restore from stdin (like tar/cpio/afio). OPTIONS
-d device The device name which is used for reading the backup. (default: /dev/cdrom) -i image Enables virtual image mode. The backup stream is read from the given image file. You have to use this option, if you are restoring from a dumped image too. (default: none) -l size Specifies the media size. This value is used to display the free space on the media only. By default the given value is taken as megabytes. You can append a single letter to the number to select: (k)ilobytes, (m)egabytes, (g)igabytes or (s)ectors (e.g. 170k, 4488m, 350000s). (default: 650m) -t track The number of the data track on the media for reading the backup. (default: none) -T Enables test mode. The complete restore process is done to test data integrity (includes CRC checksum test, if available), but no data is output. NOTE: This only verifies that the data is readable by cdrestore at all. This doesn't guarantee that your backup software will be able to do a real restore with the data. -F Forces cdrestore to begin the restore in the middle of a multi-disk set. This may be useful if you have lost a disk or a disk is badly damaged. NOTE: This will most probably start the restore in the middle of a file. It's up to your backup software to sync to the beginning of the next file. -R Disable the kernel readahead for the CDROM device during the restore process. (see cdbackup(1) Known problems) -c command The command which is executed whenever cdrestore needs to request a new media for multi-disk backups. This command (or script) should prompt the user and return after the device is ready again. The command receives one argument, which is the device name passed with -d. This can be used to issue commands to the device like ejecting the media. (default: use internal diskchange prompt) -q Queries the media, prints out the contents and exits. -v Enables verbose mode. -D Enables DEBUG output (probably not useful for normal use). -V Prints out version information and exits. EXAMPLES
Query the 700 MB media on /dev/sr0: cdrestore -d /dev/sr0 -l 700 -q Restore a tar archive to the current directory from track 2 of a 702 MB media on /dev/scd0: cdrestore -d /dev/scd0 -l 702 -t 2 | tar xf - Query the contents of a virtual image: cdrestore -i /tmp/vimage -l 4488m -q Check data integrity of track 3 in a virtual image after dumping it to DVD media: cdrestore -i /dev/dvd -t 3 -T AUTHORS
Stefan Hulswitt <s.huelswitt@gmx.de> SEE ALSO
cdbackup(1) LICENSE
Copyright (c) 2000-2004 Craig Condit, Stefan Hulswitt. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR- RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CON- TRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Stefan Hulswitt 0.7.0 cdrestore(1)
All times are GMT -4. The time now is 01:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy