Solved

AWK help

Posted on 2004-08-06
7
245 Views
Last Modified: 2010-04-20
hello group ,

I have huge log file .In which I have to filter name and date from the file how can i do it from awk.Suppose if i have radius.log in which i have to know that kaushalender have logined or not and i can filter it on date also suppose on 6-8-2004 how many times he has logined.please help me
thanx
kaushalender
0
Comment
Question by:kaushalender
7 Comments
 
LVL 11

Expert Comment

by:avizit
ID: 11733590
canyou show a few lines of  the log file ?
0
 
LVL 20

Expert Comment

by:Gns
ID: 11734344
CC avizit, if you give a sample of the log this is likely very simple.

-- Glenn
0
 
LVL 6

Accepted Solution

by:
de2Zotjes earned 125 total points
ID: 11735898
I am not sure why you would want to use awk right away. If you are only interested in number of logins  it is much faster and easier to do a grep and wc:

grep kaushalinder radius.log|grep '6-8-2004'|wc -l

This will give you the number of lines in radius.log which contain kaushalinder and 6-8-2004.
0
 
LVL 1

Assisted Solution

by:eric_j_kropf
eric_j_kropf earned 125 total points
ID: 11735922
OK... If you have a log file (radius.log) and you want to filter the log based on username and dates and return how many times the person logged in, you would not need awk.

Use grep, like so:

cat radius.log | grep <date format> | grep <username> | wc -l

This will return the number of lines in the log, filtered by the date and username given.
0
 
LVL 2

Expert Comment

by:_kiew
ID: 11865026
You can even do a:

grep -c <username>

instead of:

grep <username> | wc -l
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now