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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:12:08+00:00 2026-06-12T16:12:08+00:00

I run a minecraft server and like to periodically clean up my log files.

  • 0

I run a minecraft server and like to periodically clean up my log files. I’ve developed a bunch of regex commands that I am able to use in gedit or notepad++, and they work perfectly, but I’d like to be able to automate the process.

The essential file-cleaning command would look like this:

cat server.log | sed -e 's/REGEXTODELETE//g' > server.log

but I’m having trouble getting the regex commands to translate properly to SED. I’m using sed on a CentOS6.3 box.

Here’s an example of a command that works in notepad++:

^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ \[INFO\] Connection reset$

But when I enter it into my bash script:

cat server.clean.log | sed -e 's/^[0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]* \[INFO\] Connection reset$//g' > server.clean.log

it empties the whole file. I’ve looked all over, and I suspect I’m having an issue with whitespace, but after about an hour of searching I’m stuck. Any help is appreciated, and I can provide more examples.

  • 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-12T16:12:09+00:00Added an answer on June 12, 2026 at 4:12 pm

    The problem is you are overwriting the input file before it is being read.

    cat server.clean.log | sed -e 's/^[0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]* \[INFO\]  Connection reset$//g' > server.clean.log
    

    Should be something like

    cat server.log | sed -e 's/^[0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]* \[INFO\]  Connection reset$//g' > server.clean.log
    

    In general,

    program <infile >infile
    

    will not work (reliably) since infile will get truncated before program gets a chance to read it

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

Sidebar

Related Questions

purpose: use php to input commands directly into the minecraft server console Im trying
I am writing an application (a server wrapper for Minecraft) that I wish to
I'm using a crontab to run a maintenance script for my minecraft server. Most
I heard that minecraft server is very leaky, can consume a lot of resources
Basically I run a minecraft server on a Centos 6.2 16GB system I boot
I run the following command to link the different files in my project. /opt/gcc-4.7-cilkplus/bin/gcc
To run the spec files & assets as coffee script, I decided to go
I run vim in profiler mode vim --startuptime vim.log 188.898 000.073 000.073: sourcing /home/slavik/.vim/bundle/syntastic/syntax_checkers/perl.vim
I run a SaaS that allows free trials. Basically if you register you get
I am setting up a little service to allow people to run temporary Minecraft

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.