Solved

AWK help

Posted on 2004-08-06
7
265 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access_log 17 118
Setting up Two Three NICs with One on a Different Subnet 22 75
su - oracle could not open session 6 71
Ubuntu Apache Webserver - File Permissions 5 31
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
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 get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

815 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

9 Experts available now in Live!

Get 1:1 Help Now