Sponsored Content
Top Forums Shell Programming and Scripting Script to capture string in a log file Post 302920221 by pratikgupta123 on Wednesday 8th of October 2014 07:54:12 AM
Old 10-08-2014
I am not having access to a machine right now so cant test a code but my logic would be something like this:

1. Loop on the file line by line
2. Add the line to an array by default
3. Continue adding the lines until you reach a line that starts with date.
4. At this point analyze if the existing lines in the array have exception word in it or not
5. If yes then print it to output file and flush the array and add next line to it
5. If no then flush the array and add next line to it
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

capture nohup log file

Hi, I am running my script using nohup, but I am not able to capture the log file for that process could naybody please help... Here is what I am doing.... nohup ./script & 1>/home/user1/log.txt but I am not able to capture the log.....Is there anyother way I can capture the log... (2 Replies)
Discussion started by: mgirinath
2 Replies

2. Shell Programming and Scripting

Capture the command run in the log file

Hi , I have seen some log files where they have captured the command that is being executed, comments present in the scripts and the out put of the command as well, through scripts. could any one of you please let me know how do i do that? Thanks in advance. Cheers, Waseem (4 Replies)
Discussion started by: ahmedwaseem2000
4 Replies

3. Shell Programming and Scripting

capture output of file and send last string thereof to new file

Hello, If I run a program from within shell, the output is displayed in the command line terminal. Is there a way I can capture that output and choose only the very last string in it to send it to a new file? Thank you (6 Replies)
Discussion started by: Lorna
6 Replies

4. Shell Programming and Scripting

How to capture output to log file

Hi I have a script that will run multiple unix & sql commands. I want to see the output as well as capture it to a log file for further analysis. Is there an easy way to do that instead of adding "tee -a logfile" on everyline or even on the execute line (i.e. script | tee -s logfile). Thanks (1 Reply)
Discussion started by: nimo
1 Replies

5. Shell Programming and Scripting

Need to capture certain text from a string in a different file

Hi, I wanted to know how i could accomplish this in a script using ksh. Lets say there is a file called test.dat and it has a certain input like below : . . Hi = 56 Hi = 67 . . 1 record(s) selected Now i need to capture the numbers after the = sign and store them in a... (3 Replies)
Discussion started by: Siddarth
3 Replies

6. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

7. Shell Programming and Scripting

Shell script to capture ORA errors from Alert Log

Hi, as the title says, I am after a simple script, which will open the Alert log from an 11.2.0.1 Linux environment and mail the error message and description to a recipient email address. I can then schedule this job via cron and let it run every 15 minutes. I have searched online... (16 Replies)
Discussion started by: jnrpeardba
16 Replies

8. Shell Programming and Scripting

How to capture a string enclose by a pattern within a file?

Hi all, My file :test.txt just like this: ........................... From: 333:123<sip:88888888888@bbbb.com To: <sip:123456@aaaaa.com ......................... I want a script to capture the string between sip: & @ Expect output: 88888888888 123456 Please help! (4 Replies)
Discussion started by: Alex Li
4 Replies

9. Shell Programming and Scripting

String capture from ip file

Dear All From below mention input file I want op file as mention. Kindly help. IP file: "BSCGNR4_IPA17_C" 329 140119 0717 RXOCF-105 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN Needed OP: 140119 0717 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN Note that string mark in red as variable in... (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

10. Shell Programming and Scripting

Help on script to capture info on log file for a particular time frame

Hi I have a system running uname -a Linux cmovel-db01 2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012 x86_64 GNU/Linux I would like to capture the contents of /var/log/syslog from 11:00AM to 11:30AM and sent to this info via email. I was thinking in set a cron entry at that... (2 Replies)
Discussion started by: fretagi
2 Replies
Mail::DKIM::TextWrap(3pm)				User Contributed Perl Documentation				 Mail::DKIM::TextWrap(3pm)

NAME
Mail::DKIM::TextWrap - text wrapping module written for use with DKIM SYNOPSIS (FOR MAIL::DKIM USERS) use Mail::DKIM::TextWrap; Just add the above line to any program that uses Mail::DKIM::Signer and your signatures will automatically be wrapped to 72 characters. SYNOPSIS (FOR OTHER USERS) my $output = ""; my $tw = Mail::DKIM::TextWrap->new( Margin => 10, Output => $output, ); $tw->add("Mary had a little lamb, whose fleece was white as snow. "); $tw->finish; print $output; DESCRIPTION
This is a general-purpose text-wrapping module that I wrote because I had some specific needs with Mail::DKIM that none of the contemporary text-wrapping modules offered. Specifically, it offers the ability to change wrapping options in the middle of a paragraph. For instance, with a DKIM signature: DKIM-Signature: a=rsa; c=simple; h=first:second:third:fourth; b=Xr2mo2wmb1LZBwmEJElIPezal7wQQkRQ8WZtxpofkNmXTjXf8y2f0 the line-breaks can be inserted next to any of the colons of the h= tag, or any character of the b= tag. The way I implemented this was to serialize the signature one element at a time, changing the text-wrapping options at the start and end of each tag. TEXT WRAPPING OPTIONS
Text wrapping options can be specified when calling new(), or by simply changing the property as needed. For example, to change the number of characters allowed per line: $tw->{Margin} = 20; Break a regular expression matching characters where a line break can be inserted. Line breaks are inserted AFTER a matching substring. The default is "/s/". BreakBefore a regular expression matching characters where a line break can be inserted. Line breaks are inserted BEFORE a matching substring. Usually, you want to use Break, rather than BreakBefore. The default is "undef". Margin specifies how many characters to allow per line. The default is 72. If no place to line-break is found on a line, the line will extend beyond this margin. Separator the text to insert when a linebreak is needed. The default is " ". If you want to set a following-line indent (e.g. all lines but the first begin with four spaces), use something like " ". Swallow a regular expression matching characters that can be omitted when a line break occurs. For example, if you insert a line break between two words, then you are replacing a "space" with the line break, so you are omitting the space. On the other hand, if you insert a line break between two parts of a hyphenated word, then you are breaking at the hyphen, but you still want to display the hyphen. The default is "/s/". CONSTRUCTOR
new() - create a new text-wrapping object my $tw = Mail::DKIM::TextWrap->new( Output => $output, %wrapping_options, ); The text-wrapping object encapsulates the current options and the current state of the text stream. In addition to specifying text wrapping options as described in the section above, the following options are recognized: Output a scalar reference, or a glob reference, to specify where the "wrapped" text gets output to. If not specified, the default of STDOUT is used. METHODS
add() - process some text that can be wrapped $tw->add("Mary had a little lamb. "); You can add() all the text at once, or add() the text in parts by calling add() multiple times. finish() - call when no more text is to be added $tw->finish; Call this when finished adding text, so that any remaining text in TextWrap's buffers will be output. flush() - output the current partial word, if any $tw->flush; Call this whenever changing TextWrap's parameters in the middle of a string of words. It explicitly allows a line-break at the current position in the string, regardless of whether it matches the current break pattern. perl v5.10.1 2010-02-28 Mail::DKIM::TextWrap(3pm)
All times are GMT -4. The time now is 06:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy