Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8619135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:16:16+00:00 2026-06-12T06:16:16+00:00

I’m not 100% certain how to phrase my question simply, so I apologize if

  • 0

I’m not 100% certain how to phrase my question simply, so I apologize if this has been answered somewhere and I was just unable to find it.

What I have are debug logs with authentication packets in them along with a bunch of other output. I need to search through about 2 million lines of logs to find every packet that contains a certain mac address.

The packets look something like this (slightly censored):

-----------------[ header ]-----------------
Event:     Authd-Response (1900)
Sequence:  -54
Timestamp: 1969-12-31 19:30:00 (0)
---------------[ attributes ]---------------
Auth-Result = Auth-Accept
Service-Profile-SID = 53
Service-Profile-SID = 49
RADIUS-Access-Accept-Attr/WiMAX-Capability = 0x(numbers)
Session-Timeout = 3600
Service-Profile-SID = 4
Service-Profile-SID = 29
Chargeable-User-Identity = "(Numbers)"
User-Password = "(the MAC address I'm looking for)"
--------------------------------------------

However there are about 10 different possible types with different possible lengths. They all start with the header line and end with the all-dashes line.

I’ve had success using awk to get the code blocks themselves using this:

awk '/-----------------\[ header \]-----------------/,/--------------------------------------------/' filename.txt

But I was hoping to be able to use it to return only the packets which contain the MAC address that I need.

I’ve been trying to figure this out for a few days now and I’m pretty stuck. I could try and write a bash script, but I could swear that I’ve used awk to do something like this before…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:16:17+00:00Added an answer on June 12, 2026 at 6:16 am

    One way.

    Assuming infile with following content (three headers with different MACs):

    -----------------[ header ]-----------------
    Event:     Authd-Response (1900)
    Sequence:  -54
    Timestamp: 1969-12-31 19:30:00 (0)
    ---------------[ attributes ]---------------
    Auth-Result = Auth-Accept
    Service-Profile-SID = 53
    Service-Profile-SID = 49
    RADIUS-Access-Accept-Attr/WiMAX-Capability = 0x(numbers)
    Session-Timeout = 3600
    Service-Profile-SID = 4
    Service-Profile-SID = 29
    Chargeable-User-Identity = "(Numbers)"
    User-Password = "ab:89:67:45:23:01"
    --------------------------------------------
    -----------------[ header ]-----------------
    Event:     Authd-Response (1900)
    Sequence:  -54
    Timestamp: 1969-12-31 19:30:00 (0)
    ---------------[ attributes ]---------------
    Auth-Result = Auth-Accept
    Service-Profile-SID = 53
    Service-Profile-SID = 49
    RADIUS-Access-Accept-Attr/WiMAX-Capability = 0x(numbers)
    Session-Timeout = 3600
    Service-Profile-SID = 4
    Service-Profile-SID = 29
    Chargeable-User-Identity = "(Numbers)"
    User-Password = "01:23:45:67:89:ab"
    --------------------------------------------
    -----------------[ header ]-----------------
    Event:     Authd-Response (1900)
    Sequence:  -54
    Timestamp: 1969-12-31 19:30:00 (0)
    ---------------[ attributes ]---------------
    Auth-Result = Auth-Accept
    Service-Profile-SID = 53
    Service-Profile-SID = 49
    RADIUS-Access-Accept-Attr/WiMAX-Capability = 0x(numbers)
    Session-Timeout = 3600
    Service-Profile-SID = 4
    Service-Profile-SID = 29
    Chargeable-User-Identity = "(Numbers)"
    User-Password = "00:00:45:67:89:ab"
    --------------------------------------------
    

    Run following awk script:

    awk -v mac="01:23:45:67:89:ab" '
        BEGIN { 
            RS = "-+\\[ header \\]-+"; 
            FS = "\n"; 
        } 
        ## Save record separator. I must do at the beginning because later the
        ## variable is reset. ¿Bug?
        FNR == 1 {
            record_sep = RT;
        }
        { 
            ## Go throught each line searching for the MAC. If found print
            ## the whole block.
            for (i = 1; i <= NF; i++ ) { 
                if ( match( $i, mac ) > 0 ) {
                    print record_sep, $0;
                    break;
                }
            } 
        }
    ' infile
    

    That yields:

    -----------------[ header ]----------------- 
    Event:     Authd-Response (1900)
    Sequence:  -54
    Timestamp: 1969-12-31 19:30:00 (0)
    ---------------[ attributes ]---------------
    Auth-Result = Auth-Accept
    Service-Profile-SID = 53
    Service-Profile-SID = 49
    RADIUS-Access-Accept-Attr/WiMAX-Capability = 0x(numbers)
    Session-Timeout = 3600
    Service-Profile-SID = 4
    Service-Profile-SID = 29
    Chargeable-User-Identity = "(Numbers)"
    User-Password = "01:23:45:67:89:ab"
    --------------------------------------------
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.