Sponsored Content
Full Discussion: replacing multiple lines
Top Forums Shell Programming and Scripting replacing multiple lines Post 19269 by ajnabi on Monday 8th of April 2002 05:14:39 PM
Old 04-08-2002
Network help requred

i have a file :
sample1.txt

OBJECT="POINT" ACTION="REDEFINE" POINT_NAME="ABCD001G "
GHYT_POPRIORITY_1="1"
GHYT_POPRIORITY_2="1"
GHYT_POPRIORITY_3="1"
GHYT_POPRIORITY_4="1"
GHYT_POPRIORITY_USER="1"
HIGH_ALARM_PRIORITY_1="1"
HIGH_ALARM_PRIORITY_2="1"
HIGH_ALARM_PRIORITY_3="1"
HIGH_ALARM_PRIORITY_4="1"
HIGH_ALARM_PRIORITY_USER="1"
LOW_SENSOR_LIMIT="0.0038"
HIGH_SENSOR_LIMIT="0.022"
OPERATING_RANGE_LOW="0"
OPERATING_RANGE_HIGH="600"
FIELD_TRANSMITTER_TYPE="MA"
THERMOCOUPLE_UNITS="F"
GHYT_POLIMIT_1_TYPE="V"
GHYT_POLIMIT_1_VALUE="-1"
HIGH_ALARM_LIMIT_1_TYPE="V"
HIGH_ALARM_LIMIT_1_VALUE="250"

OBJECT="POINT" ACTION="REDEFINE" POINT_NAME="NGBLT04C"
GHYT_POPRIORITY_1="1"
GHYT_POPRIORITY_2="1"
GHYT_POPRIORITY_3="1"
GHYT_POPRIORITY_4="1"
GHYT_POPRIORITY_USER="1"
HIGH_ALARM_PRIORITY_1="1"
HIGH_ALARM_PRIORITY_2="1"
HIGH_ALARM_PRIORITY_3="1"
HIGH_ALARM_PRIORITY_4="1"
HIGH_ALARM_PRIORITY_USER="1"
LOW_SENSOR_LIMIT="0.0038"
HIGH_SENSOR_LIMIT="0.0205"
FIELD_TRANSMITTER_TYPE="MA"
THERMOCOUPLE_UNITS="F"
LOW_ALARM_LIMIT_1_TYPE="V"
LOW_ALARM_LIMIT_1_VALUE="-1"
HIGH_ALARM_LIMIT_1_TYPE="V"
HIGH_ALARM_LIMIT_1_VALUE="250"


wHAT I NEED TO DO

I HAVE TO REPLACE SOME FIELDS FROM A FILE

sample2.txt

NGBPT001A 0 300
NGBLT04C 0 100
NGBLT04B 0 100

I HAVE TO REPLACE FOLLOWNG TWO FIELDS in sample1.txt WITH VALUE IN MY SECOND FILE sample2.txt RESPECTIVELY IN COLUMN 1 & 2 for followng fields

LOW_ALARM_LIMIT_1_VALUE="-1"
HIGH_ALARM_LIMIT_1_VALUE="250"

New to sed ... hard for me to do wth multiple fields
wIll aprecIate help ....

Tx

Last edited by ajnabi; 04-09-2002 at 01:07 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replacing multiple lines with single line

Can any one give me the idea on replacing multiple blank lines with a single blank line? Please conside it for a file having more than 100 number of characters. Regards, Siba (3 Replies)
Discussion started by: siba.s.nayak
3 Replies

2. Shell Programming and Scripting

replacing a quote in some lines with multiple quote fields

i want to replace mistaken quotes in line starting with tag 300 and relocate the quote in the correct position so the input is 223;25 224;20100428064823;1;0;0;0;0;0;0;0;8;1;3;9697;18744;;;;;;;;;;;; 300;X;Event:... (3 Replies)
Discussion started by: wradwan
3 Replies

3. Shell Programming and Scripting

Replacing pattern spanning multiple lines

Hi. I have input like this: <tr> <td class="logo1" rowspan="2"><a href="index.html"><img src="images/logo.png" /></a></td> <td class="pad1" rowspan="2">__</td> <td class="userBox"><img src="images/person.png"/> <a href="http://good.mybook.com/login.jsp">Sign In</a></td> <td... (5 Replies)
Discussion started by: zorrox
5 Replies

4. Shell Programming and Scripting

searching multiple lines and replacing in shell scripting

Hi, I have a file with below contents, ssenthil = rw anilkg = rw I want to search for "ssenthil" and need to delete line 1 and 2 , if the third line starts with "" respectively and blank line immediately and third line starts with " anilkg = rw Please help me . Great day... (5 Replies)
Discussion started by: anil8103
5 Replies

5. Shell Programming and Scripting

Replacing multiple lines in file from another file

Hi All, I'm trying to parse a XML file and replace few lines of file with text present in another file. But only issue is I need to replace only those lines from XML which are preceeding the JOBNAME =*RRN* For ex test.xml(content of XML file in which I want to replace lines is ) <JOB . . .... (10 Replies)
Discussion started by: techneel
10 Replies

6. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

7. Shell Programming and Scripting

Replacing System.out.println with Logger.println in *.java using SED (spanned over multiple lines)

Hi, Can anyone help me out for my below problem. I need to replace all System.out.println with Logger.println in *.java using SED (spanning multiple lines) including current & sub-directories. I tried with below command. But it is not replacing when source text is spanned over multiple... (4 Replies)
Discussion started by: Bhanu Dhulipudi
4 Replies

8. Shell Programming and Scripting

Bash Scripting Help to automate replacing multiple lines

Background: I am writing a script to help me automate tweaks and things I apply to a custom Android rom I developed. I am on the very last part of my script, and I am stuck trying to find the right command to do what I seek. When I build roms from source, a file called updater-script is... (8 Replies)
Discussion started by: Silverlink34
8 Replies

9. Shell Programming and Scripting

Replacing a single line with multiple lines in a file

Hi Am confused with the usage of "sed" command I want to replace a single line with multiple lines of a file.. eg., A file has Hi, How are you? I need to replace as Am fine What are You doing? I used the script as string1="Hi, How are you?" echo "$string1 is the value"... (4 Replies)
Discussion started by: Priya Amaresh
4 Replies

10. Shell Programming and Scripting

Removing multiple lines from input file, if multiple lines match a pattern.

GM, I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed. I am assuming that sed, awk or even perl could do what I need. I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies
ECACCESS-FILE-MOVE(1p)					User Contributed Perl Documentation				    ECACCESS-FILE-MOVE(1p)

NAME
ecaccess-file-move - Move or Rename ECaccess Files SYNOPSIS
ecaccess-file-move -version|-help|-manual ecaccess-file-move [-debug] source-ecaccess-file target-ecaccess-file DESCRIPTION
Allow moving an ECaccess File. When the move occurs within the same ECaccess File System then it is a rename. When the move occurs across two different ECaccess File Systems then first a copy is done and then a delete of the original file is done (e.g. similar to ecaccess- file-copy ... -erase). The source-ecaccess-file and target-ecaccess-file are in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. ARGUMENTS
source-ecaccess-file The source ECaccess File name. target-ecaccess-file The target ECaccess File name. OPTIONS
-version Display version number and exits. -help Print a brief help message and exits. -manual Prints the manual page and exits. -debug Display the SOAP messages exchanged. EXAMPLES
ecaccess-file-move ec:test1.txt ec:test2.txt Rename the test1.txt file in the ECFS directory of the authenticated user in test2.txt. ecaccess-file-move ec:test1.txt home:test2.txt Copy the test1.txt file from the ECFS directory of the authenticated user to the test2.txt file in the $HOME directory of the authenticated user, then delete the test1.txt file from ECFS. SEE ALSO
ecaccess-file-delete, ecaccess-file-get, ecaccess-file-mget, ecaccess-file-modtime, ecaccess-file-mput, ecaccess-file-rmdir, ecaccess-file- copy, ecaccess-file-dir, ecaccess-file-mdelete, ecaccess-file-mkdir, ecaccess-file-chmod, ecaccess-file-put, ecaccess-file-size and ecaccess. perl v5.14.2 2012-04-16 ECACCESS-FILE-MOVE(1p)
All times are GMT -4. The time now is 04:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy