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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:42:46+00:00 2026-05-16T07:42:46+00:00

The corrupt table entry is logged in the error file something like this… /usr/local/mysql/bin/mysqld:

  • 0

The corrupt table entry is logged in the error file something like this…

/usr/local/mysql/bin/mysqld: Incorrect
key file for table
‘./accounts/headers.MYI’; try to
repair it

I want to write a query that will repair this table.

REPAIR TABLE accounts.headers;

What I need to do is search for the first instance of “./” and select the first word i.e. “accounts” and choose the next word “headers”.
Now use these two variables to write a statement like shown above.
Should I write a Shell script for this purpose?

  • 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-05-16T07:42:47+00:00Added an answer on May 16, 2026 at 7:42 am

    You can use grep and sed to do this:

    pax> cat qq.in
    /blah: Incorrect key file for table './accounts/headers.MYI'; try blah
    /blah: Incorrect key file for table './pax/diablo.myi'; try blah
    
    pax> grep 'Incorrect key file for ' qq.in | sed
         -e 's/.*\.\//REPAIR TABLE /g'
         -e 's/\//./'
         -e 's/\.[Mm][Yy][Ii].*/;/g'
    REPAIR TABLE accounts.headers;
    REPAIR TABLE pax.diablo;
    

    Note that I’ve put all those -e sections on different lines for readability. They should be all on one line to test.

    If your version of sed supports case-insensitive searches (like the GNU one does), you can replace that last substitution with 's/\.myi.*/;/Ig'.


    To catch lines with different foramts is a bit trickier and will require all the formats to be known to avoid false positives. The following command will catch the alternate format as supplied in your comment:

    pax> cat qq.in
    /blah: Incorrect key file for table './accounts/headers.MYI'; try blah
    /blah: Incorrect key file for table './linus/torvalds.myi'; try blah
    /usr/local/mysql/bin/mysqld: Table './beta/search_data' is marked as crashed
    
    allachan@IBM-L3F3936 ~
    $ egrep 'Incorrect key|as crashed' qq.in | sed
        -e "s/.*\.\//REPAIR TABLE /g"
        -e "s/[\\.'].*/;/g"
        -e "s/\//./"
    REPAIR TABLE accounts.headers;
    REPAIR TABLE linus.torvalds;
    REPAIR TABLE beta.search_data;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

sometimes i get an error like table is marked as corrupt and shld be
I have a text file something like: lineat2 corrupt exitCode() and so on... Each
i encounter an error like Error 1 fatal error LNK1107: invalid or corrupt file:
Incorrect key file for table 'widgets'; try to repair it This is the error
I'm a MySQL newbe and I'm trying to fix a corrupt table in one
During my work on this database application, I've apparently managed to corrupt a form
My Problem is the following. I got this code and i guess a corrupt
I'm getting a very strange behavior in MySQL, which looks like some kind of
If I'm writing a simple text log file from multiple processes, can they overwrite/corrupt
I have a MySQL table with a field named description , with a record

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.