Sponsored Content
Full Discussion: Replacing some part of file
Top Forums Shell Programming and Scripting Replacing some part of file Post 302387759 by atlantis on Monday 18th of January 2010 08:17:37 AM
Old 01-18-2010
Hi Franklin,

I think I did not explain it clearly in my previous post. Now for example consider the file2 content as

RMR*CO*206Z130004706B**199.93
NTE*OTH*ACCT#J-445-294-1748 366N
DTM*003*091201


and the file1 content as

GS*RA*071000013*102562451P*091130*0520*334052023*X*003050
ST*820*334052023
BPR*C*509.77*C*ACH*CTX*01*071000013*DA*5529085*9000002008**01*071000013*DA*5529085*091130
NTE*ZZZ*QWEST80217E
REF*PY*A97983
REF*TN*081000602100305*TRACE NUMBER FROM THE ACH PAYMENT
DTM*020*091127
N1*PR*CIS INFO. VEND.*ZZ*PAYER FROM ACH
ENT*1*AG*94*CASS
N1*BT*AT&T MOBILITY
RMR*IV*206Z130004706B**214.93
NTE*OTH*ACCT#J-520-294-1749 877M
DTM*003*091101
RMR*IV*503Z130027168B**294.84
NTE*OTH*ACCT#J-644-294-1659 877M
DTM*003*091018
RMR*IV*456Z130027123C**294.84
SE*000014*334052023
GE*1*334052023

Here some content are highlighted in red. We can find the same lines in file2. I want the highlighted 3 lines in file1 to be replaced with content from file2 like

GS*RA*071000013*102562451P*091130*0520*334052023*X*003050
ST*820*334052023
BPR*C*509.77*C*ACH*CTX*01*071000013*DA*5529085*9000002008**01*071000013*DA*5529085*091130
NTE*ZZZ*QWEST80217E
REF*PY*A97983
REF*TN*081000602100305*TRACE NUMBER FROM THE ACH PAYMENT
DTM*020*091127
N1*PR*CIS INFO. VEND.*ZZ*PAYER FROM ACH
ENT*1*AG*94*CASS
N1*BT*AT&T MOBILITY
RMR*CO*206Z130004706B**199.93
NTE*OTH*ACCT#J-445-294-1748 366N
DTM*003*091201

RMR*IV*503Z130027168B**294.84
NTE*OTH*ACCT#J-644-294-1659 877M
DTM*003*091018
RMR*IV*456Z130027123C**294.84
SE*000014*334052023
GE*1*334052023

Sorry for the confusion from my side. Please advice.

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help regarding replacing a part of string

Hi all suppose i have a string "abacus sabre", i need to replace occurences 'ab' with 'cd' and i need to store this result into same string and i need to return this result from script to the calling function, where as the string is passed from calling function. i tried like this ... (1 Reply)
Discussion started by: veerapureddy
1 Replies

2. Shell Programming and Scripting

Replacing the part of file name?

Hi All One of my script generate following files. These files has static TIMESTAMP 20080227. AccAdd_20080227_1000.dat AccBal_20080227_1000.dat Acc_20080227_1000.dat AccGrpMem_20080227_1000.dat AccToCust_20080227_1000.dat What i need to do is, once the file has been generated, it... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies

3. UNIX for Dummies Questions & Answers

Replacing part of a text file with user input.

Ok, I am brand new to UNIX and I am trying to learn a cross between basic script and database use. I had got some ideas off the net on simple ideas for learning UNIX. I am working on creating a simple phone book program that allows myself to enter our employees from work into a phone book text... (0 Replies)
Discussion started by: georgefurbee
0 Replies

4. Shell Programming and Scripting

Replacing part of a pattern in sed

Hi I have a piece of xml that has a pattern like this <int>159</int><int>30</int> I want to find this pattern but only substitute the second part of the pattern to {rid1}. Is that possible in sed ? Thanks. ---------- Post updated at 12:10 PM ---------- Previous update was at 12:01 PM... (11 Replies)
Discussion started by: vnn
11 Replies

5. Shell Programming and Scripting

Replacing part of XML code inside comment tags

Hello! I'd like to modify custom values in a XML config file between comment tags using bash script. <feature> <keyboardshortcut>C-m</keyboardshortcut> <option1>disabled</option2> <option2>enabled</option2> </feature> <!-- bash script features START --> <feature> ... (2 Replies)
Discussion started by: prism1
2 Replies

6. Shell Programming and Scripting

Awk: Need help replacing a specific column in a file by part of a column in another file

Hi, I have two input files as File1 : ABC:client1:project1 XYZ:client2-aa:project2 DEF:client4:proj File2 : client1:W-170:xx client2-aa:WT-04:yy client4:L-005A:zz Also, array of valid values can be hardcoded like Output : ABC:W:project1 XYZ:WT:project2 (1 Reply)
Discussion started by: aa2601
1 Replies

7. Shell Programming and Scripting

Replacing part of the sentence using echo and sed

Hi, Iam using ksh and trying to execute the following syntax to replace one word of the sentence with a new word. But somehow sed is not able to replace the old value with new value. Please let me know where Iam going wrong. Sample Code : --> export line="VORTEX,abcdef" export... (3 Replies)
Discussion started by: ajithab
3 Replies

8. Shell Programming and Scripting

Renaming Filenames by replacing a part

Hi, I have little experience on Shell scripts, I searched the forum but couldn't make out what I want. I want to rename a set of files to a new file name a_b_20100101 c_d_20100101 ....................... ...................... I want to rename the files to a_b_20140101... (5 Replies)
Discussion started by: JaisonJ
5 Replies

9. UNIX for Dummies Questions & Answers

Replacing part of filename

Hi guys! I have quite a lot of files like all_10001_ct1212307460308.alf* and I want to get rid of the first number for all at once like: all_ct1212307460308.alf* How can I do this in the shell? (12 Replies)
Discussion started by: TimmyTiz
12 Replies

10. Shell Programming and Scripting

Replacing part of a delimited string

Hello, I have some tab delimited text data that I am processing. The second column looks like, NAME;pyrimidine-2,4-diol;cpd;2;line;37 I need to clean this up to just the name, pyrimidine-2,4-diol All lines have the same format, NAME;text;cpd;int;line;int followed by tab I have tried... (6 Replies)
Discussion started by: LMHmedchem
6 Replies
dat_ep_disconnect(3DAT) 			     Direct Access Transport Library Functions				   dat_ep_disconnect(3DAT)

NAME
dat_ep_disconnect - terminate a connection or a connection establishment SYNOPSIS
cc [ flag... ] file... -ldat [ library... ] #include <dat/udat.h> DAT_RETURN dat_ep_disconnect ( IN DAT_EP_HANDLE ep_handle, IN DAT_CLOSE_FLAGS disconnect_flags ) PARAMETERS
ep_handle Handle for an instance of Endpoint. disconnect_flags Flags for disconnect. Flag values are as follows: DAT_CLOSE_ABRUPT_FLAG Abrupt close. This is the default value. DAT_CLOSE_GRACEFUL_FLAG Graceful close. DESCRIPTION
The dat_ep_disconnect() function requests a termination of a connection or connection establishment. This operation is used by the active/client or a passive/server side Consumer of the connection model. The disconnect_flags parameter allows Consumers to specify whether they want graceful or abrupt disconnect. Upon disconnect, all outstand- ing and in-progress DTOs and RMR Binds must be completed. For abrupt disconnect, all outstanding DTOs and RMR Binds are completed unsuccessfully, and in-progress DTOs and RMR Binds can be completed successfully or unsuccessfully. If an in-progress DTO is completed unsuccessfully, all follow on in-progress DTOs in the same direction also must be completed unsuccessfully. This order is presented to the Consumer through a DTO completion Event Stream of the recv_evd_handle and and request_evd_handle of the Endpoint. For graceful disconnect, all outstanding and in-progress request DTOs and RMR Binds must try to be completed successfully first, before disconnect proceeds. During that time, the local Endpoint is in a DAT_EP_DISCONNECT_PENDING state. The Consumer can call abrupt dat_ep_disconnect() when the local Endpoint is in the DAT_EP_DISCONNECT_PENDING state. This causes the End- point to transition into DAT_EP_STATE_DISCONNECTED without waiting for outstanding and in-progress request DTOs and RMR Binds to success- fully complete. The graceful dat_ep_disconnect() call when the local Endpoint is in the DAT_EP_DISCONNECT_PENDING state has no effect. If the Endpoint is not in DAT_EP_STATE_CONNECTED, the semantic of the operation is the same for graceful or abrupt disconnect_flags value. No new Send, RDMA Read, and RDMA Write DTOs, or RMR Binds can be posted to the Endpoint when the local Endpoint is in the DAT_EP_DISCON- NECT_PENDING state. The successful completion of the disconnect is reported to the Consumer through a DAT_CONNECTION_EVENT_DISCONNECTED event on con- nect_evd_handle of the Endpoint. The Endpoint is automatically transitioned into a DAT_EP_STATE_DISCONNECTED state upon successful asyn- chronous completion. If the same EVD is used for connect_evd_handle and any recv_evd_handle and request_evd_handle, all successful Comple- tion events of in-progress DTOs precede the Disconnect Completion event. Disconnecting an unconnected Disconnected Endpoint is no-op. Disconnecting an Endpoint in DAT_EP_STATE_UNCONNECTED, DAT_EP_STATE_RESERVED, DAT_EP_STATE_PASSIVE_CONNECTION_PENDING, and DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING is disallowed. Both abrupt and graceful disconnect of the Endpoint during connection establishment, DAT_EP_STATE_ACTIVE_CONNECTION_PENDING and DAT_EP_STATE_COMPLETION_PENDING, "aborts" the connection establishment and transitions the local Endpoint into DAT_EP_STATE_DISCONNECTED. That causes preposted Recv DTOs to be flushed to recv_evd_handle. RETURN VALUES
DAT_SUCCESS The operation was successful. DAT_INVALID_HANDLE The ep_handle parameter is invalid. DAT_INSUFFICIENT_RESOURCES The operation failed due to resource limitations. DAT_INVALID_PARAMETER The disconnect_flags parameter is invalid. DAT_INVALID_STATE A parameter is in an invalid state. Endpoint is not in the valid state for disconnect. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard: uDAPL, 1.1, 1.2 | +-----------------------------+-----------------------------+ |MT-Level | Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
libdat(3LIB), attributes(5) SunOS 5.10 16 Jul 2004 dat_ep_disconnect(3DAT)
All times are GMT -4. The time now is 03:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy