03-13-2014
Scrutinizer, yours seems to work only when there are multiple occurrences of the string ID and not in events when the string ID exists only once. It should still perform the same for those situations.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
In a file a pattern is occured many times randomly. Even it may appear more then once in the same line too. How i can get the number of times that pattern appeared in the file? let the file name is abc.txt and the pattern is "xyz".
I used the following code:
grep -ic "xyz" abc.txt
but it is... (3 Replies)
Discussion started by: palash2k
3 Replies
2. Shell Programming and Scripting
Hello,
Actually i want to replace the word after a matched pattern.
For Ex:
lets say that i am reading a file line by line
while read line
do
echo $line
# i need to search whether a pattern exists in the file and replace the word after if the pattern exist.
# for example :... (1 Reply)
Discussion started by: maxmave
1 Replies
3. Shell Programming and Scripting
Hi,
If there exist multiple pattern in a file, how can I find the last record matching the pattern through perl.
The below script searches for the pattern everywhere in an input file.
#! /usr/bin/perl -s -wnl
BEGIN {
$pattern or
warn"Usage: $0 -pattern='RE' \n" and
exit 255;... (5 Replies)
Discussion started by: er_ashu
5 Replies
4. Shell Programming and Scripting
would like to print word between matched patterns using sed
for example :
create INDEX SCOTT.OR_PK ON table_name(....)
would like to print between SCOTT. and ON which is OR_PK
Please help me out
Thanks (4 Replies)
Discussion started by: jhonnyrip
4 Replies
5. Shell Programming and Scripting
Hi,
I have script like below:
#!/usr/local/bin/perl
use strict;
use warnings;
while (<DATA>) {
( my ($s_id) = /^\d+\|(\d+?)\|/ ) ;
if ( $s_id == 1 ){
s/^(.*\|)*.*ABC\.pi=(+|+)*.*ABC\.id=(\d+|+).*$/$1$2|$3/s;
print "$1$2|$3\n"; (2 Replies)
Discussion started by: sol_nov
2 Replies
6. Shell Programming and Scripting
Hello every,
I am stuck in a problem. I have file like this. I want to add the fifth field of the match pattern line above the lines starting with "# @D". The delimiter is "|"
eg
>
# @D0.00016870300|0.05501020000|12876|12934|3||Qp||Pleistocene||"3 Qp Pleistocene"|Q
# @P... (5 Replies)
Discussion started by: jyu3
5 Replies
7. Shell Programming and Scripting
Hi,
I have two files file1.txt and file2.txt. Please see the attachments.
In file2.txt (which actually is a diff output between two versions of file1.txt.), I extract the pattern corresponding to 1172c1172. Now ,In file1.txt I have to search for this pattern 1172c1172 and if found, I have to... (9 Replies)
Discussion started by: saurabh kumar
9 Replies
8. Shell Programming and Scripting
Hi,
I need to extract an info in $1 based on a matched pattern in $2,$3,$4, and $5.
The sample input file as follows:-
ID Pat1 Pat2 Pro1 use1
add41 M M M
add87 M M M M
add32 ... (16 Replies)
Discussion started by: redse171
16 Replies
9. UNIX for Advanced & Expert Users
Hi I want to print the line until pattern is matched.
I am using below code:
sed -n '1,/pattern / p' file
It is working fine for me , but its not working for exact match.
sed -n '1,/^LAC$/ p' file
Input:
LACC FEGHRA 0
LACC FACAF 0
LACC DARA 0
LACC TALAC 0
LAC ILACTC 0... (8 Replies)
Discussion started by: Abhisrajput
8 Replies
10. UNIX for Beginners Questions & Answers
I have two files say FILE1 and FILE2.
FILE1 contains 80,000 filename in sorted order and another file FILE2 contains 6,000 filenames is also in sorted order.
I want to compare the filename for each file and copy them in to a folder when filename is matched.
File1.txt contain 80,000... (8 Replies)
Discussion started by: imranrasheedamu
8 Replies
LEARN ABOUT MOJAVE
tcl_dowhenidle
Tcl_DoWhenIdle(3) Tcl Library Procedures Tcl_DoWhenIdle(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tcl_DoWhenIdle, Tcl_CancelIdleCall - invoke a procedure when there are no pending events
SYNOPSIS
#include <tcl.h>
Tcl_DoWhenIdle(proc, clientData)
Tcl_CancelIdleCall(proc, clientData)
ARGUMENTS
Tcl_IdleProc *proc (in) Procedure to invoke.
ClientData clientData (in) Arbitrary one-word value to pass to proc.
_________________________________________________________________
DESCRIPTION
Tcl_DoWhenIdle arranges for proc to be invoked when the application becomes idle. The application is considered to be idle when
Tcl_DoOneEvent has been called, could not find any events to handle, and is about to go to sleep waiting for an event to occur. At this
point all pending Tcl_DoWhenIdle handlers are invoked. For each call to Tcl_DoWhenIdle there will be a single call to proc; after proc is
invoked the handler is automatically removed. Tcl_DoWhenIdle is only usable in programs that use Tcl_DoOneEvent to dispatch events.
Proc should have arguments and result that match the type Tcl_IdleProc:
typedef void Tcl_IdleProc(ClientData clientData);
The clientData parameter to proc is a copy of the clientData argument given to Tcl_DoWhenIdle. Typically, clientData points to a data
structure containing application-specific information about what proc should do.
Tcl_CancelIdleCall may be used to cancel one or more previous calls to Tcl_DoWhenIdle: if there is a Tcl_DoWhenIdle handler registered for
proc and clientData, then it is removed without invoking it. If there is more than one handler on the idle list that refers to proc and
clientData, all of the handlers are removed. If no existing handlers match proc and clientData then nothing happens.
Tcl_DoWhenIdle is most useful in situations where (a) a piece of work will have to be done but (b) it is possible that something will hap-
pen in the near future that will change what has to be done or require something different to be done. Tcl_DoWhenIdle allows the actual
work to be deferred until all pending events have been processed. At this point the exact work to be done will presumably be known and it
can be done exactly once.
For example, Tcl_DoWhenIdle might be used by an editor to defer display updates until all pending commands have been processed. Without
this feature, redundant redisplays might occur in some situations, such as the processing of a command file.
BUGS
At present it is not safe for an idle callback to reschedule itself continuously. This will interact badly with certain features of Tk
that attempt to wait for all idle callbacks to complete. If you would like for an idle callback to reschedule itself continuously, it is
better to use a timer handler with a zero timeout period.
KEYWORDS
callback, defer, idle callback
Tcl 7.5 Tcl_DoWhenIdle(3)