Sponsored Content
Top Forums Shell Programming and Scripting Display lines for a particular year in a file using grep Post 303010653 by skoshekay on Thursday 4th of January 2018 06:11:08 PM
Old 01-04-2018
Display lines for a particular year in a file using grep

hi,

I have a log file with data for more than 3 years, i want only the rows for the year 2017, say for example.

My file has the data like this

Code:
08-OCT-2015 11:17:35 AAA, BBBB

08-OCT-2017 11:17:35 AAA,Bdfdfd,dfdfd,dfd

08-Nov-2017 11:17:35 AAA,Bdfdfd,dfdfd,deree


i want the rows with the year 2017, so my output should be 2 rows like this


Code:
08-OCT-2017 11:17:35 AAA,Bdfdfd,dfdfd,dfd

08-Nov-2017 11:17:35 AAA,Bdfdfd,dfdfd,deree

i was using a grep with data function but it never returned any rows.

Thanks in advance,

Last edited by rbatte1; 01-05-2018 at 05:33 AM.. Reason: CODE tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need year to display from ftped files list

Hi All, p_ftp=dummy time ftp -niv 192.0.0.2 << EOF user dummy dummy cd prt/$p_ftp ascii ls -ltr quit output is -rw-r--r-- 1 500 500 5137 Mar 04 11:21 dummy.csv can any one suggest how to get year while using ftp (1 Reply)
Discussion started by: Vrgurav
1 Replies

2. UNIX for Dummies Questions & Answers

Grep and display n lines after the match is found.

Hello, How do I use grep to find a pattern in a list of file and then display 5 lines after the pattern is matched Eg: I want to match the string GetPresentCode in all files in a folder and then see 4 lines following this match. I am not sure if grep is what should be used to achieve. Thanks!... (3 Replies)
Discussion started by: cv_pan
3 Replies

3. Solaris

grep and display few lines before and after

Hi is there a way in grep to display few lines before and after the pattern?? I tried options A and B and after-context and before-context. But they don't work on Solaris platform. please advise. (13 Replies)
Discussion started by: melanie_pfefer
13 Replies

4. Shell Programming and Scripting

grep and display lines from a file

I have to grep on a few words in a file and then display the line containing those words and the line above it. For ex - File1.txt contains... abc xyz abc This is a test Test successful abc xyz abc Just a test Test successful I find the words 'Test successful' in the file... (6 Replies)
Discussion started by: user7617
6 Replies

5. UNIX for Dummies Questions & Answers

Using grep and zgrep then display the next few lines

Hello everyone. I would like to know if I can use grep or zgrep to search for a particular pattern then print the x number of lines after the pattern was found. Lets say for example a pattern was found on line 3, I wanted the output to show lines 3, 4 and 5. Thanks! (10 Replies)
Discussion started by: khestoi
10 Replies

6. Programming

C++ Display months of year in a double dimensional array

stupid question (0 Replies)
Discussion started by: puttster
0 Replies

7. Shell Programming and Scripting

Grep word after last occurance of string and display next few lines

Hi, I wanted to grep string "ERROR" and "WORNING" after last occurrence of String "Starting" only and wanted to display two lines after searched ERROR and WORNING string and one line before. I have following cronjob log file "errorlog" file and I have written the code for same in Unix as below... (17 Replies)
Discussion started by: nes
17 Replies

8. Shell Programming and Scripting

Grep multiple exact match, do not display lines

Hi, Need help to grep the following from a file x. I just want to grep exact match not lines and not partial word. CONFSUCCESS CONFFAIL CONFPARTIALSUCCESS >cat x xczxczxczc zczczcxx CONFSUCCESS czczczcczc czxxczxzxczcczc CONFFAIL xczxczcxcczczc zczczczcz CONFPARTIALSUCCESS czczxcxzc ... (4 Replies)
Discussion started by: rajeshwebspere
4 Replies

9. Shell Programming and Scripting

Grep pattern and display all lines below

Hi I need to grep for a patter and display all lines below the pattern. For ex: say my file has the below lines file1 file2 file3 file4 file5 I NEED to grep for patter file3 and display all lines below the pattern. do we have an option to get this data. Let me know if you require... (5 Replies)
Discussion started by: venkidhadha
5 Replies

10. Shell Programming and Scripting

Grep and display multiple lines

Hi guys, I have a log file that generates multiple logs about a query. <query time='2016-04-13 13:01:50.825'> <PagingRequestHandler> <Before>brand:vmu</Before> <After>brand:vmu</After> </PagingRequestHandler> <GroupDeviceFilterHandler> <Before>brand:vmu</Before> ... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies
mipadmin(1M)															      mipadmin(1M)

NAME
mipadmin - Mobile IPv4 administration utility SYNOPSIS
conf_file] [option] level] level] DESCRIPTION
is a program for performing Mobile IPv4 administration tasks, such as starting and stopping Mobile IPv4 daemons and getting information on various system parameters. The tool can interact with Mobile IPv4 daemons mipd(1M) and miprod(1M). Only root user can run When is started, the tool first reports the name and PID of the Mobile IPv4 daemon running on the system, if any. Based on this report, the user is restricted on the options that can be used. For instance, most reporting options cannot be used when no daemon is running. Another example is that the option cannot be used if a Mobile IPv4 daemon is found running. Options recognizes the following options. These can be given as command line arguments or as commands in a session. To start a session, execute without any command line arguments. options can be classified into two kinds: Administrative and Reporting. Administrative Options These options must be used exclusively, that is, they cannot be used with other administrative or reporting options. These options can be used at the command line or at the session prompt. (Abbr.: Start a Mobile IPv4 daemon. and specify the daemon to start. Note that will verify that the daemon is running before allowing use of certain reporting options. If no daemon is specified with this option, is the default daemon. (mobility agent) starts and (correspondent node) starts and cannot both be started on the same system, since only one daemon can run on a single system. If is started, the user will be notified if any interface is restarted with enabled. (Abbr.: Specify the configuration file the daemon should use. If no file is specified, the tool will start with (see mipd.conf(4)) and with (see miprod.conf(4)). (Abbr.: Stop a Mobile IPv4 daemon. If the daemon stopped is will query it for the list of interfaces on which it offers services. These interfaces have enabled, which can be disabled once is stopped. These interfaces will be dis- played to the user and will be restarted with disabled if the daemon is stopped. (Abbr. Obtain help on options. option specifies the option for which help is required. (Abbr.: Exit the session. Reporting Options Multiple reporting options may be specified at the command line or can be concatenated to form commands at the session prompt. Options that report information from the daemon can be used only when a Mobile IPv4 daemon is running. Unless stated otherwise in the description, the option applies to both and Exceptions on the usage of an option is based on the type of daemon currently running. Certain options may apply only to while others only to Even in the case of some options may apply depending on the daemon's configuration with respect to AAA functionality. offering AAA functionality is said to be in 'AAA-mode'. This terminology is used in the option descriptions below. Note that can operate in two modes: normal and AAA-mode. The option can be used to verify the mode of operation. (Abbr.: Report configuration information from the daemon. Note that this information is not reported from the configuration file. For a list of configuration information, see mipconfig(1M) or mipd.conf(4) for and miproconfig(1M) or miprod.conf(4) for (Abbr.: Global configuration information. For this information includes any AAA data. (Abbr.: Information on all security associations configured on the daemon. For these include security asso- ciations to mobile or correspondent nodes. For the information is for all home agents. (Abbr.: Information on all interfaces configured on the daemon. For these include all interfaces on which Mobility Services are offered. For information is reported for the interface that is the source IP address for all tunnels created. (Abbr.: Reports all configuration data. It is also the default option if the user does not specify any option. (Abbr.: This option applies only to It reports any home agent mobility bindings information. The option sets display mode to verbose. (Abbr.: This option applies only to It reports foreign agent visitor list information. The option sets display mode to verbose. (Abbr.: Report general information and statistical counters from the daemon. The option resets statistical counters to 0. (Abbr.: Report events (if any) logged by daemon in syslogd(1M). This option may be used even when no daemon is running. The daemon whose events are reported is selected according to the following rules: If a daemon is specified, then the most recent instance of this daemon that has logged entries in syslog is selected. If daemon is unspecified and a daemon is currently running, then the the daemon currently running is selected. If dae- mon is unspecified and no daemon is currently running, then the most recent instance of that has logged entries in sys- log is selected. selects the most recent instance of that logged entries into and selects the most recent instance of that logged entries into (Abbr.: The class of events to display. If this option is not used, then the events logged under all classes are dis- played. The level parameter may be repeated multiple times. Note that for each input to level, only events for that class are displayed. That is, events below this class in the event class hierarchy (if any) are not dis- played. (Abbr.: These messages include unrecoverable error conditions such as fatal configuration errors and daemon initialization errors. (Abbr.: These messages include recoverable error conditions including some Mobile Node registration failures. (Abbr.: These messages include conditions such as dropped packets due to unsupported features, or no system resources. (Abbr.: These messages provide detailed event logging for debugging and troubleshooting purposes. (Abbr.: Report contents of router advertisement messages sent out by This option applies only to The option sets display mode to verbose. (Abbr.: Report or change a daemon's logging level. (Abbr.: The new logging level will include any log levels below it in the hierarchy. The logging levels (from lowest to highest) are: (Abbr.: These messages include unrecoverable error conditions such as fatal configuration errors and daemon initialization errors. (Abbr.: These messages include recoverable error conditions including some Mobile Node registration failures. (Abbr.: These messages include events such as dropped packets due to unsupported features, or no system resources. (Abbr.: These messages provide detailed event logging for debugging and troubleshooting purposes. (Abbr.: Report information on any tunnels created by or For acting as a Foreign agent, this displays the tunnels from the For- eign agent to the Home Agents. For acting as a Home Agent, this displays the tunnels from the Home Agent to the For- eign Agents, and to Mobile nodes using a co-located address. For the tunnels report displays the tunnels from the Cor- respondent node to the Foreign Agent and to the Mobile nodes using a co-located address. This option may be used even when no daemon is running. The option sets display mode to verbose. (Abbr.: Report version information from the daemon. (Abbr.: Report route optimization information from the daemon. For it reports the Binding Update messages sent to correspon- dent nodes. For the option reports the Correspondent Node's Binding Cache. The option sets display mode to verbose. (Abbr.: This option applies only to operating in AAA-mode. It reports information from the dynamic home address pools (if any). Information includes addresses in the pool and whether or not they have been allocated to a Mobile Node (identi- fied by NAI). (Abbr.: This option applies only to operating in AAA-mode. It reports information on any active AAA sessions maintained by the daemon. The option sets display mode to verbose. AUTHOR was developed by Hewlett-Packard Company. SEE ALSO mipd(1M), mipconfig(1M), miproconfig(1M), miprod(1M), mipd.conf(4), miprod.conf(4). mipadmin(1M)
All times are GMT -4. The time now is 04:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy