Thanks to everyone for their efforts. Sorry, was away for few days and didn't get the time to look at the solutions provided.
I tried all scripts from this forum but none of the script worked. All the scripts fetching the lines for entire day instead of last 30 min. My requirement is to pull the lines for last 30 min only.
Script used (for e.g.) :
Output from the above script:
Please suggest as I need to pull last 30 min lines only whenever i execute this script not for the entire day.
Moderator's Comments:
Please use CODE tags as required by forum rules!
Last edited by RudiC; 03-09-2019 at 03:35 PM..
Reason: Added CODE tags.
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT NETBSD
cal
CAL(1) BSD General Commands Manual CAL(1)NAME
cal -- displays a calendar
SYNOPSIS
cal [-3hjry] [-A after] [-B before] [-d day-of-week] [-R reform-spec] [[month] year]
DESCRIPTION
cal displays a simple calendar. If arguments are not specified, the current month is displayed. The options are as follows:
-3 Same as ``-A 1 -B 1''.
-A after
Display after months after the specified month.
-B before
Display before months before the specified month.
-d day-of-week
Specifies the day of the week on which the calendar should start. Valid values are 0 through 6, presenting Sunday through Saturday,
inclusively. The default output starts on Sundays.
-h Highlight the current day, if present in the displayed calendar. If output is to a terminal, then the appropriate terminal sequences
are used, otherwise overstriking is used. If more than one -h is used and output is to a terminal, the current date will be high-
lighted in inverse video instead of bold.
-j Display Julian dates (days one-based, numbered from January 1).
-R reform-spec
Selects an alternate Gregorian reform point from the default of September 3rd, 1752. The reform-spec can be selected by one of the
built-in names (see NOTES for a list) or by a date of the form YYYY/MM/DD. The date and month may be omitted, provided that what is
specified uniquely selects a given built-in reform point. If an exact date is specified, then that date is taken to be the first
missing date of the Gregorian Reform to be applied.
-r Display the month in which the Gregorian Reform adjustment was applied, if no other month or year information is given. If used in
conjunction with -y, then the entire year is displayed.
-y Display a calendar for the current year.
If no parameters are specified, the current month's calendar is displayed. A single parameter specifies the year and optionally the month in
ISO format: ``cal 2007-12'' Two parameters denote the month (1 - 12) and year. Note that the century must be included in the year.
A year starts on Jan 1.
NOTES
In the USA and Great Britain the Gregorian Reformation occurred in 1752. By this time, most countries had recognized the reformation
(although a few did not recognize it until the 1900's.) Eleven days following September 2, 1752 were eliminated by the reformation, so the
calendar for that month is a bit unusual.
In view of the chaotic way the Gregorian calendar was adopted throughout the world in the years between 1582 and 1928 make sure to take into
account the date of the Gregorian Reformation in your region if you are checking a calendar for a very old date.
cal has a decent built-in list of Gregorian Reform dates and the names of the countries where the reform was adopted:
Italy Oct. 5, 1582 Denmark Feb. 19, 1700
Spain Oct. 5, 1582 Great Britain Sep. 3, 1752
Portugal Oct. 5, 1582 Sweden Feb. 18, 1753
Poland Oct. 5, 1582 Finland Feb. 18, 1753
France Dec. 12, 1582 Japan Dec. 20, 1872
Luxembourg Dec. 22, 1582 China Nov. 7, 1911
Netherlands Dec. 22, 1582 Bulgaria Apr. 1, 1916
Bavaria Oct. 6, 1583 U.S.S.R. Feb. 1, 1918
Austria Jan. 7, 1584 Serbia Jan. 19, 1919
Switzerland Jan. 12, 1584 Romania Jan. 19, 1919
Hungary Oct. 22, 1587 Greece Mar. 10, 1924
Germany Feb. 19, 1700 Turkey Dec. 19, 1925
Norway Feb. 19, 1700 Egypt Sep. 18, 1928
The country known as Great Britain can also be referred to as England since that has less letters and no spaces in it. This is meant only as
a measure of expediency, not as a possible slight to anyone involved.
HISTORY
A cal command appeared in Version 6 AT&T UNIX.
BSD December 21, 2007 BSD