Sponsored Content
Top Forums Shell Programming and Scripting How to insert values in 1st occurance out of two occurance in a file Post 302210802 by Franklin52 on Wednesday 2nd of July 2008 03:44:33 AM
Old 07-02-2008
One way:

Code:
awk 'BEGIN{FS=OFS="\""}
$2=="TestIp1" && i && !j {$4="9.9.9.9";j++}
$2=="TestIp1" && !i {$4="8.8.8.8";i++}
1' file

Regards
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

count string occurance in a file hourly

Hi, I file that has all the status for one day (24hours). Now what I want to do is to count the occurence of a string in its output hourly like for example count occurance of successful or asynchronous clear destinon for every hour and redirect it to file. Please see sample file below. Please... (2 Replies)
Discussion started by: ayhanne
2 Replies

2. UNIX for Dummies Questions & Answers

replace the n'th occurance in a file

Hi All, How can i replace the n'th occurance in a file. ? I have a property file like EAR;_TrackingEAR;META-INF/application.xml;xml;context-root;1;valeur EAR;_TrackingEAR;META-INF/application.xml;xml;context-root;2;valeur2... (2 Replies)
Discussion started by: subin_bala
2 Replies

3. UNIX for Dummies Questions & Answers

i need 100th occurance of a letter in file

Hi to all, I am looking a file in vi editor to get 100th occurance of a latter in that file. Can any one help me in this? Thanks Sathish (1 Reply)
Discussion started by: bsathishmca
1 Replies

4. Shell Programming and Scripting

Copy subsequent contents of a file from first occurance of grep

There is a file which logs all errors and alerts of the database called alert log. I have a requirement as follows: 1. Check the current date and search for the first occurance of the current date in the alert log. 2. As soon as the first occurance is found, copy the subsequent contents... (5 Replies)
Discussion started by: sunpraveen
5 Replies

5. Shell Programming and Scripting

search and replace the last occurance of a match in a file

HI please let me know if there is any command to search and replace only the last occurence of a string in aline. Eg: " This cat is a cat with a tail longer of all cat." I need to replace only the last "cat" in the above line. thanks (3 Replies)
Discussion started by: harikris614
3 Replies

6. Shell Programming and Scripting

Remove the last occurance in a file

Hi, I have hunted for an answer to this but still can't come up with a working solution. How do I delete the last of a non unique line The lines I am looking for is case "$0" in esac This can appear n times I only want the last deleted. I have tried with sed and... (1 Reply)
Discussion started by: miyoung999
1 Replies

7. Shell Programming and Scripting

Multiple occurance of file

Hi all, I have file structure as file.log 84t-rw-r--r-- 1 emily04 us_cms 24492717 Oct 5 13:29 vgtree_84_1_K3L.root 85t-rw-r--r-- 1 emily04 us_cms 50410380 Oct 5 16:06 vgtree_85_1_uZv.root 85t-rw-r--r-- 1 emily04 us_cms 50567380 Oct 5 16:06 vgtree_85_1_hjv.root 86t-rw-r--r-- 1 emily04... (4 Replies)
Discussion started by: emily
4 Replies

8. Shell Programming and Scripting

[Need help] perl script to find the occurance of string from a text file

I have two files 1. input.txt 2. keyword.txt input.txt has contents like .src_ref 0 "call.s" 24 first 0x000000 0x5a80 0x0060 BRA.l 0x60 .src_ref 0 "call.s" 30 first 0x000002 0x1bc5 RETI .src_ref 0 "call.s" 31 first 0x000003 0x6840 ... (2 Replies)
Discussion started by: acdc
2 Replies

9. Shell Programming and Scripting

Help search and replace the last occurance of match in a file

Hi I want to replace only the last occurance of "union all" in input file with ";" I tried with sed 's/union all/;/g' in my input file, it replaced in all lines of input file Eg: select column1,column2 from test1 group by 2 union all select column1,column2 from test2 group by 2 union all ... (9 Replies)
Discussion started by: antosr7
9 Replies

10. UNIX for Beginners Questions & Answers

Insert text after the first occurance of searched string entry in a file

My server xml file has huge data part of which i'm sharing below. I wish to add the below text held by variable "addthisline" after the closing braces i.e --> once the first </Connector> tag is found. addthisline="I need to be inserted after the comments" Thus my searchstring is... (3 Replies)
Discussion started by: mohtashims
3 Replies
rsm_intr_signal_post(3RSM)			      Remote Shared Memory Library Functions				rsm_intr_signal_post(3RSM)

NAME
rsm_intr_signal_post, rsm_intr_signal_wait - signal or wait for an event SYNOPSIS
cc [ flag... ] file... -lrsm [ library... ] #include <rsmapi.h> int rsm_intr_signal_post(void *memseg, uint_t flags); int rsm_intr_signal_wait(void *memseg, int timeout); DESCRIPTION
The rsm_intr_signal_post() and rsm_intr_signal_wait() functions are event functions that allow synchronization between importer processes and exporter processes. A process may block to wait for an event occurance by calling rsm_intr_signal_wait(). A process can signal a wait- ing process when an event occurs by calling rsm_intr_signal_post(). The rsm_intr_signal_post() function signals an event occurance. Either an import segment handle (rsm_memseg_import_handle_t) or an export segment handle (rsm_memseg_export_handle_t) may be type cast to a void pointer for the memseg argument. If memseg refers to an import han- dle, the exporting process is signalled. If memseg refers to an export handle, all importers of that segment are signalled. The flags argu- ment may be set to RSM_SIGPOST_NO_ACCUMULATE; this will cause this event to be discarded if an event is already pending for the target seg- ment. The rsm_intr_signal_wait() function allows a process to block and wait for an event occurance. Either an import segment handle (rsm_mem- seg_import_handle_t) or an export segment handle (rsm_memseg_export_handle_t) may be type cast to a void pointer for the memseg argument. The process blocks for up to timeout milliseconds for an event to occur; if the timeout value is -1, the process blocks until an event occurs or until interrupted. RETURN VALUES
Upon successful completion, these functions return 0. Otherwise, an error value is returned to indicate the error. ERRORS
The rsm_intr_signal_post() and rsm_intr_signal_wait() functions can return the following error: RSMERR_BAD_SEG_HNDL Invalid segment handle. The rsm_intr_signal_post() function can return the following error: RSMERR_CONN_ABORTED Connection aborted. RSMERR_REMOTE_NODE_UNREACHABL Remote node not reachable. The rsm_intr_signal_wait() function can return the following errors: RSMERR_INTERRUPTED Wait interrupted. RSMERR_TIMEOUT Timer expired. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
rsm_memseg_get_pollfd(3RSM), attributes(5) SunOS 5.11 7 Nov 2002 rsm_intr_signal_post(3RSM)
All times are GMT -4. The time now is 05:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy