Solved

AWK help

Posted on 2004-08-06
7
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

729 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