?
Solved

AWK help

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

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…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

764 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