Sponsored Content
Top Forums Shell Programming and Scripting Extract word between two KEYWORDS Post 302833917 by rajamadhavan on Thursday 18th of July 2013 04:53:26 AM
Old 07-18-2013
Code:
$ perl -pe 's/.+HELLO_(.+)_BYE.+/\1/' file
HOW_ARE_YOU
WHERE_ARE
HOW

 

10 More Discussions You Might Find Interesting

1. AIX

extract same word from two files

file1 contains: 3 file2 contains: 1 2 3 . . 20000 cat file1 | while read line do grep -s $line file2 >> file3 done my result file3 shows: 3 3 3 (4 Replies)
Discussion started by: tjmannonline
4 Replies

2. Shell Programming and Scripting

extract numbers from a word

Hi ppl, I am a bit lost on this...can some one assist. I know this can be down with awk or sed, but i cant get the exact syntax right. I need to only extract the numbers from a signle word ( eg abcd.123.xyz ) How can i extract 123 only ? Thanks (14 Replies)
Discussion started by: systemali
14 Replies

3. UNIX for Dummies Questions & Answers

Word extract from a line

In a file let a.txt, has 1 line code i.e. code QC:Tiger:10: /code I need to get my output like "Tiger 10". So how can i do this? (3 Replies)
Discussion started by: anupdas
3 Replies

4. Shell Programming and Scripting

Extract word using sed

Hello, I am new to sed and am trying to extract a word using sed. for example i have a line "const TotalAmount& getTotalAmount() const; " in the file test.txt I am trying to extract getTotalAmount() from the line. For this i tried cat test.txt | sed -n 's/.*get*\(\)//p But... (8 Replies)
Discussion started by: prasbala
8 Replies

5. Shell Programming and Scripting

Extract word from a line

Hi, I've searched the forum to get what I wanted but to no avail. Here's the problem I'm facing. The line is suppose as below: <INPUT DATABASE ="ORACLE" DBNAME ="UNIX" NAME ="FACT_TABLE" OWNERNAME ="DIPS"> Now I want to extract only FACT_TABLE. The trials are as follows: awk... (3 Replies)
Discussion started by: dips_ag
3 Replies

6. Shell Programming and Scripting

extract whole thing in word, leaving behind last word. - perl

Hi, i've a string /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD/TESi T_11_HD_120/hd-12 i need to get string, like /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD the words from HD should get deleted, i need only a string till HD, i dont want to use any built in... (4 Replies)
Discussion started by: asak
4 Replies

7. Shell Programming and Scripting

Extract a word from sentence

$SET_PARAMS='-param Run_Type_Parm=Month -param Portfolio_Parm="997" -param From_Date_Parm="2011-08-09"' Want to extract the value of "Portfolio_Parm" from $SET_PARAMS i.e in the above case "997" & assigned to new variable. The existence order of "Portfolio"Parm" can change, but the name... (2 Replies)
Discussion started by: SujeethP
2 Replies

8. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

9. Shell Programming and Scripting

Extract lines from file using keywords using script

Hi I need some lines of text from input file using keywords. Inputfile IP IS 10.238.52.65 pun-ras-bng-mhs-01#context bsnl.in Card Status : 1:0, 2:1, 3:1, 4:1, 5:0, 6:0, 7:0, 8:0, 9:1, 10:0, 11:0, 12:0, 13:0, 14:1, Max Circuits: 1: 0, 2: 32768, ... (5 Replies)
Discussion started by: surender reddy
5 Replies

10. Shell Programming and Scripting

Extract words before and after a certain word.

I have a sample text file with file name: sample.txt The text file has the following text. this is an example text where we have to extract certain words before and after certain word these words can be used later to get more information I want to extract n (a constant) words before and... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies
Mail::SpamAssassin::Timeout(3)				User Contributed Perl Documentation			    Mail::SpamAssassin::Timeout(3)

NAME
Mail::SpamAssassin::Timeout - safe, reliable timeouts in perl SYNOPSIS
# non-timeout code... my $t = Mail::SpamAssassin::Timeout->new({ secs => 5, deadline => $when }); $t->run(sub { # code to run with a 5-second timeout... }); if ($t->timed_out()) { # do something... } # more non-timeout code... DESCRIPTION
This module provides a safe, reliable and clean API to provide alarm(2)-based timeouts for perl code. Note that $SIG{ALRM} is used to provide the timeout, so this will not interrupt out-of-control regular expression matches. Nested timeouts are supported. PUBLIC METHODS
my $t = Mail::SpamAssassin::Timeout->new({ ... options ... }); Constructor. Options include: secs => $seconds time interval, in seconds. Optional; if neither "secs" nor "deadline" is specified, no timeouts will be applied. deadline => $unix_timestamp Unix timestamp (seconds since epoch) when a timeout is reached in the latest. Optional; if neither secs nor deadline is specified, no timeouts will be applied. If both are specified, the shorter interval of the two prevails. $t->run($coderef) Run a code reference within the currently-defined timeout. The timeout is as defined by the secs and deadline parameters to the constructor. Returns whatever the subroutine returns, or "undef" on timeout. If the timer times out, "$t-<gt"timed_out()> will return 1. Time elapsed is not cumulative; multiple runs of "run" will restart the timeout from scratch. On the other hand, nested timers do observe outer timeouts if they are shorter, resignalling a timeout to the level which established them, i.e. code running under an inner timer can not exceed the time limit established by an outer timer. When restarting an outer timer on return, elapsed time of a running code is taken into account. $t->run_and_catch($coderef) Run a code reference, as per "$t-<gt"run()>, but also catching any "die()" calls within the code reference. Returns "undef" if no "die()" call was executed and $@ was unset, or the value of $@ if it was set. (The timeout event doesn't count as a "die()".) $t->timed_out() Returns 1 if the most recent code executed in "run()" timed out, or "undef" if it did not. $t->reset() If called within a "run()" code reference, causes the current alarm timer to be restored to its original setting (useful after our alarm setting was clobbered by some underlying module). perl v5.16.3 2011-06-06 Mail::SpamAssassin::Timeout(3)
All times are GMT -4. The time now is 02:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy