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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:01:27+00:00 2026-06-05T08:01:27+00:00

I have a log file which I need to replay on the server. It

  • 0

I have a log file which I need to “replay” on the server.

It contains entries like this:

Request:
        query: EXEC prc_insert_customer
        @param0: 110040851
        @param1: 137463
        @param2: user@example.com
        @param3: John
        @param4: Smith
        @param5: Some address
        @param6:
        @param7:
        @param8: Some city
        @param9: GBR
        @param10: POSTCODE
        @param11: (555) 123-45-67
Response:

...

I need to convert each chunk like that into

EXEC prc_insert_customer '110040851', '137463',  ..., '(555) 123-45-67'

I tried to use awk for that:

/EXEC prc_insert_customer/ {
        str = "EXEC prc_insert_customer";
}

str && /@param/ {
        if ($1 == "@param0:")
                sep = ""
        else
                sep = ","
        str = ((str) (sep) " '"($2) ("'"))
}

/^Response/ {
        if (str)
                print str
        str = ""
}

but the output I get is:

', '(555)'DE', '', 'Some', 'GBR0851

How do I get correct output?

I use GNU Awk 4.0.0 on Fedora 17.

  • 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-05T08:01:29+00:00Added an answer on June 5, 2026 at 8:01 am

    If the log files Windows based, then you are almost certainly dealing with side-effects (affects? ;->) of the evil ^M char. It can defintely produce problems as you’re describing.

     sub(/^M/,"", $0)
    

    should help.

    Thats a real Ctrl-M char and not 2 chars’^’,’M’, produced in a vi compliant editor by pressing Ctrl-V and tne Ctrl-M.

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a log file which contains hundreds/thousands of seperate XML messages and need
I have a log file where some of the entries look like this: YY/MM/DD
I have a formatted string from a log file, which looks like: >>> a=test
I have a really huge log file from which i need to search stuff.
I have a simple log file which is very messy and I need it
I have a simple log file which is very messy and I need it
I have a large server log file (~750 MB) which I can't open with
I am working with a log file and I have a method which is
I have a log.txt file on the root of my application. I would like
I have an external log file which name changes each session, with the format

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.