Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

AWK help

Posted on 2004-08-06
7
Medium Priority
?
287 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 500 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 500 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
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.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

610 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