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 8133489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:37:06+00:00 2026-06-06T09:37:06+00:00

I am trying to use gawk to extract paragraphs from a log and it

  • 0

I am trying to use gawk to extract paragraphs from a log and it is working perfectly up to the point where I want to include the record separator it found.

This is the command:

gawk --re-interval 'BEGIN{RS="[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6} \\[[A-Z]*\\]";} /983a99f8-bec6-11e1-80dd-059a821d0b73/ {print $0}' full.log 

If I add in print RT, $0, it prints the RT of the next match not the current match.

This is some sample text

9:08:06.899627 [DEBUG] <0.30065.3>@agent:1565 Recs to loop through:  [{agent_state,"OpenAcdAgent43","Jeff",
                            undefined,wrapup,
                            {call,"983a99f8-bec6-11e1-80dd-059a821d0b73",
                                voice,
                                {"8501112234","MorganGrimes"},
                                "9201",<0.30392.3>,[],
                                {client,"8221314","DCF",[],1340629596,
                                    1340629596},
                                [creole_general],
                                <0.30398.3>,outband,inband,inbound,10},
                            1340629658,undefined,"Default",1340629658
9:08:06.899707 [INFO] <0.168.0>@cpx_monitor:649 Down message for reference #Ref<0.0.16.137225> of <0.30064.3> due to normal

What I want to be 9:08:06.899627 [DEBUG] able to do is prepend 9:08:06.899627 [DEBUG] to my match but RS takes that away. I get 9:08:06.899707 [INFO] instead.

Thanks!

  • 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-06T09:37:08+00:00Added an answer on June 6, 2026 at 9:37 am

    That’s because a record separator comes at the end of a record. So 9:08:06.899627 [DEBUG] is the end of an empty record and 9:08:06.899707 [INFO] is the end of the record that matches your GUID regex.

    You need to save the previous RT and output the saved one.

    gawk --re-interval 'BEGIN{RS="[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6} \\[[A-Z]*\\]";} /983a99f8-bec6-11e1-80dd-059a821d0b73/ {print savedRT, $0} {savedRT = RT}' full.log 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
trying to use this route: from(activemq:profiles).aggregate(header(cheese)).batchSize(30).bean(ProfilesQueueService, saveContacts) Fails with: No signature of method: org.apache.camel.model.RouteType.aggregate()
I am trying use javascript regular expressions to do some matching and I found
I am trying use Date Picker and on Select i want to display the
I want use localized strings from resources in xsl template as in aspx page,
I was trying use svn to find a checkin using svn log, but it
I am trying use std::copy to copy from two different iterator. But during course
I'm trying use to selenium with firefox on CentOS from command line like this:
i'm trying use webview to load a image from sdcard i use this path
I'm trying use double type in openCL, but doesn't work anyway, i want use

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.