topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 5:56 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Delete All Text In File Until Particular String  (Read 3274 times)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Delete All Text In File Until Particular String
« on: February 13, 2019, 04:18 AM »
Wondering how one might delete all text up until finding a particular text string.

Suppose the text string is “WXYZ”.

And suppose there are around 100 lines above the “WXYZ” line.

Too, suppose we have 1000 files to do this to.

Any suggestions appreciated.

Nicholas Kormanik


Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: Delete All Text In File Until Particular String
« Reply #1 on: February 13, 2019, 05:28 AM »
Use sed, the Stream EDitor, known from Linux, but also available for Windows. And here is a SO answer with details

The Windows download can be found here: http://gnuwin32.sour...net/packages/sed.htm

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: Delete All Text In File Until Particular String
« Reply #2 on: February 14, 2019, 06:48 PM »
Thanks Ath.  Sed it is, then.