0

I have a text file Old.txt with the below contents:

hierarchies
dimensions
products
product 11
product 12
scenario
scenario budget
actual
PerformanceUnit
PU1
PU3
PU46
PU23
PU2
PU245
NoPerformanceUnit
Noscenario
Noproduct
Noheirachies

I need a batch script to save everything in between PerformanceUnit to NoPerformanceUnit in another text file called New.txt.

Any help is appreciated.

  • This sounds like a task for a Windows implementation of awk, or for PowerShell. You can find awk in the CygWin tools, in the Windows Subsystem for Linux once you've downloaded and activated a distro, or from several locations on the web (search for awk for windows command line). – Jeff Zeitlin Apr 15 at 12:18
  • 4
    We don't write scripts if you show no effort of atleast trying. We're not a batch script service. Please do some research and edit your question to show what have you already tried – CaldeiraG Apr 15 at 12:19
  • @JeffZeitlin - You don't need something as elaborate as awk or sed for this simple case: instead, for /f "delims=" %%L in (FileName) do ... will allow you to check each line in %%L and write it or not as the boundary lines are encountered. See `for /f``. – AFH Apr 15 at 12:45
  • Possible duplicate of Extract multiple strings between two words in a file – LotPings Apr 15 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.