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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:59:15+00:00 2026-05-13T15:59:15+00:00

How can I delete the whole lines which included both subStr1 and subStr2 in

  • 0

How can I delete the whole lines which included both subStr1 and subStr2 in a big file and save as a new smaller file.

Part of my file content below.

12-23 20:27:35:265   GetVariable [Tunnel]    INFO  iVid = 536876042 data [Reruen] = System.Object[]
12-23 20:27:35:265   GetVariable [Tunnel]    INFO  iVid = 536876043 data [Reruen] = System.Object[]
12-23 20:27:33:718   SendEvent [Link]    INFO  eventID = 268435564
12-23 20:27:33:718   WaferMove [Link]    INFO  waferNumber = 122253 UNIT_ID dest = UNIT_ID_LL_A  slot = 1 bool isStarted = False
12-23 20:27:35:265   GetVariable [Tunnel]    INFO  iVid = 536876042 data [Reruen] = System.Object[]
12-23 20:27:35:265   GetVariable [Tunnel]    INFO  iVid = 536876043 data [Reruen] = System.Object[]
12-23 20:27:33:765   WaferMove(d) [Link]    INFO  waferNumber = 122253 UNIT_ID dest = UNIT_ID_LL_A  slot = 1 bool isStarted = False

And I want to deleted all the lines include both GetVariable [Tunnel] and System.Object[]
like the lines below. THANKS.

12-23 20:27:35:265   GetVariable [Tunnel]    INFO  iVid = 536876043 data [Reruen] = System.Object[]
  • 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-13T15:59:15+00:00Added an answer on May 13, 2026 at 3:59 pm

    If you can afford to have a copy of the file (which is probably safer to do) then you can open two files (one for reading original file one for writing to the result file) and skip the lines where you find the match:

    open(ORIG, '<', 'orig.txt');
    open(RESULT, '>', 'result.txt');
    while(my $line = <ORIG>) {
      # fine tune this
      next if $line =~ /GetVariable\s+\[Tunnel\].*System\.Object\[\]/;
      print RESULT $line;
    }
    close ORIG;
    close RESULT;
    

    I haven’t tried the script, so make sure to test it on an example file first.

    Edit: you need to tune the regex. play with it a little.

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

Sidebar

Related Questions

can anyone please help me with this query. I have a CSV file which
Hi I want to delete a line from a file which matches particular pattern
My program reads a file which has thousands of lines of something like this
So I can delete one row using: $this->db->delete($tableName,array(id=>4)); ...but I can't figure out how
If I have this string: k6s6k6s6c1u6t661w651z6k6z6z6k611 How can delete all the characters in even-numbers
I trying to figure out how I can delete from multiple tables in SQL
I have built CMS on cakephp framework. I can delete just one or more
I have a PHP script that deletes files. It can delete files from my
I am developing UI form that has infragistics grid. Users can delete, submit some
From the documentation: If the platform supports the unsetenv() function, you can delete items

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.