Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Extract lines if string found from last 30 min only Post 303030513 by RudiC on Tuesday 12th of February 2019 08:31:01 AM
Old 02-12-2019
Welcome to the forum.


We like and probably are able to provide help to further you from and beyond the point(s) where you're stuck. So please show us the "various awk and sed option"s you tried, and also indicate where and how they failed. Be aware that the date format of the lines you target is way more difficult to track than the one of the lines you want avoided. Does your scan need to cross midnight? Are the log entries ascending in time? Are the to-be-avoided lines interspersed regularly? By the minute?
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Best approach for a 10 min extract out of several log files with timestamped records

I have a task where I need to code a shell script to extract a 10 min range (10 min from now until now) extract of a log file. I taught I could simply use a command that would say something like Start=date - 10 min but I didn't find anything. Looks like the only solution would have to code a... (3 Replies)
Discussion started by: Browser_ice
3 Replies

2. Shell Programming and Scripting

Print lines after the search string until blank line is found

All I want is to look for the pattern in the file...If I found it at # places... I want print lines after those pattern(line) until I find a blank line. Log EXAMPLE : MT:Exception caught The following Numbers were affected: 1234 2345 2346 Error java.lang.InternalError:... (3 Replies)
Discussion started by: prash184u
3 Replies

3. Shell Programming and Scripting

Find min.max value if matching columns found using AWK

Input_ File : 2 3 4 5 1 1 0 1 2 1 -1 1 2 1 3 1 3 1 4 1 6 5 6 6 6 6 6 7 6 7 6 8 5 8 6 7 Desired output : 2 3 4 5 -1 1 4 1 6 5 6 8 5 8 6 7 (3 Replies)
Discussion started by: vasanth.vadalur
3 Replies

4. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

5. Shell Programming and Scripting

grep log lines logged in 10 min

A log files has lines (1 line per each log for a majority; a few for 2 lines per each log) May 31 14:00:11 rtprodapp1 local2:notice sudo: jdoe : TTY=pts/0 ; PWD=/home/jdoe ; USER=root ; COMMAND=/usr/bin/su - May 31 14:03:19 rtprodapp1 local2:notice sudo: jdoe : TTY=pts/0 ; PWD=/home/jdoe ;... (4 Replies)
Discussion started by: Daniel Gate
4 Replies

6. Shell Programming and Scripting

Get 20 lines above string found, and 35 below string

i want to search a log for a string. when that string is found, i want to grab the a set number of lines that came before the string, and a set number of lines that come after the string. so if i search for the word "Error" in the /var/log/messages file, how can I output the 20 lines that came... (4 Replies)
Discussion started by: SkySmart
4 Replies

7. UNIX for Advanced & Expert Users

Move a block of lines to file if string found in the block.

I have a "main" file which has blocks of data for each user defined by tags BEGIN and END. BEGIN ID_NUM:24879 USER:abc123 HOW:47M CMD1:xyz1 CMD2:arp2 STATE:active PROCESS:id60 END BEGIN ID_NUM:24880 USER:def123 HOW:4M CMD1:xyz1 CMD2:xyz2 STATE:running PROCESS:id64 END (7 Replies)
Discussion started by: grep_me
7 Replies

8. UNIX for Dummies Questions & Answers

Integrate MIN and MAX in a string

I need to use awk for this task ! input (fields are separated by ";"): 1%2%3%4%;AA 5%6%7%8%9;AA 1%2%3%4%5%6;BB 7%8%9%10%11%12;BBIn the 1st field there are patterns composed of numbers separated by "%". The 2nd field define groups (here two different groups called "AA" and "BB"). Records... (8 Replies)
Discussion started by: beca123456
8 Replies

9. Shell Programming and Scripting

Extract lines with min value, using two field separators.

I have a file with two ID columns followed by five columns of counts in fraction form. I'd like to print lines that have a count of at least 4 (so at least 4 in the numerator, e.g. 4/17) in at least one of the five columns. Input file: comp51820_c1_seq1 693 0/29 0/50 0/69 0/36 0/31... (6 Replies)
Discussion started by: pathunkathunk
6 Replies

10. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies
scan(1) 						      General Commands Manual							   scan(1)

NAME
scan - produce a one-line-per-message scan listing (only available within the message handling system, mh) SYNOPSIS
scan [+folder] [msgs] [options] OPTIONS
Directs scan to clear the screen. If the -clear switch is used and the output of scan is directed to a terminal, then scan consults the $TERM and $TERMCAP environmental variables to determine your terminal type in order to find out how to clear the screen prior to exiting. If the -clear switch is used and the output of scan is not directed to a terminal, then scan sends a formfeed prior to exiting. Re-formats the output of scan according to the instructions in the named file. The named formatfile must be in mh-format style; see mh-format(4) for more details. Re-formats the output of scan according to the instructions in the string given. The string must be in mh-format style; see mh-format(4) for more details. You must place the string argument to this command in double quotes ("). Produces a header line prior to the scan listing. The header line displays the name of the folder and the date and time. This can be suppressed using the -noheader option. Prints a list of the valid options to this command. Lists the output from scan in reverse order, from the highest message number to the lowest. The -noreverse option lists messages in the conventional way, from lowest to highest numbers. The -noreverse option is the default. Specifies the width of your screen, in columns. The defaults for this command are as follows: +folder defaults to the current folder msgs defaults to all -noheader -width defaults to the width of the terminal DESCRIPTION
The scan command produces a one-line-per-message listing of the messages in the current folder. You can scan a folder other than the current folder by using the +folder argument. You can use the msgs argument to produce a scan listing of a number of messages or a range of messages in the specified folder. You can also use scan in conjunction with a message sequence defined by mark or pick. See mark(1) for more information on sequences. Each scan line contains the message number, the date, the From: field, the Subject: field, and, if room allows, some of the body of the message. The current message is marked with a plus sign (+). The scan command actually reads each of the specified messages and parses them to extract the desired fields. If format errors are found in any of the messages during parsing, scan produces appropriate error messages. Because MH has been configured with the BERK option, scan has two additional options: -reverse and -noreverse. In addition, scan updates the MH context prior to starting the listing, so interrupting a long scan listing preserves the new context. The default configuration file that is supplied with MH has the BERK option enabled. If scan encounters a message without a Date: field, the date is filled in with the last write date of the message, and an asterisk (*) is appended. This is useful for identifying unsent message drafts. Unsent drafts are not usually allowed to contain a Date: field, and are consequently marked with an asterisk in scan listings. PROFILE COMPONENTS
Path: To determine your Mail directory Alternate-Mailboxes: To determine your mailboxes EXAMPLES
The following example produces a listing of messages 11 through 15 in the folder +inbox : % scan +inbox 11-15 11 18/01 ralph Project Plan Meeting Monday<<This 12 -21/01 johnson squash<<Thought i might postpone 13 21/01 smith@ultrixhost support from US during conversion 14 21/01 jjones@subone.dne new forum for discussion of mail 15+ 21/01 calvin@hobbes.uuc Re: new forum for discussion of m In this listing, the plus sign (+) on message 15 indicates that it is the current message. The hyphen (-) on message 12 indicates that you have replied to the message. It is produced by the -annotate option to repl; see repl(1) for more information. If there is sufficient room left on the line after the subject, scan fills the line with text from the body, preceded by <<, and terminated by >> if the body is suffi- ciently short. FILES
The user profile. SEE ALSO
inc(1), mark(1), pick(1), show(1), mh-format(4) scan(1)
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy