-1

I have the following SED command:

sed -n /"PartA/,/PartB/p" Input.txt > Output.txt

Essentially, I am using this to extract any bunch of text between PartA & PartB in the Input.txt file and write it to Output.txt

Is there any way I can do this without the use of SED , since SED is not native to windows.

So i have a log file that has a lot of text with something like this:

ABC
DEF
GHI
PARTA
123
456
PARTB
JKL
MNO
PQR
PARTA
789
PARTB
STU
VWX

I want the output to look like this

PARTA
123
456
PARTB
PARTA
789
PARTB
  • 3
    You can install `cygwin` which brings many unix-like tools to MS Win. See also http://stackoverflow.com/q/127318/1030675 – choroba Aug 26 '14 at 14:47
  • That's true. But I don't want to install any extra tools. Just wondering if this functionality could be achieved using the existing windows capability. – Mehzin Baker Aug 26 '14 at 15:13
  • The command line utilities included with Windows aren't nearly as powerful as the ones included with Linux. – Mark Ransom Aug 26 '14 at 15:56
  • 2
    no much idea of SED. can you provide a sample input text and the expected output text? – gbabu Aug 26 '14 at 16:08
  • `findstr /r` will do a regex search of a file. Type `findstr /?` at the command line or search google for help using it. – indiv Aug 27 '14 at 06:25
  • I've added my sample input & output. Please let me know if that would be any help. – Mehzin Baker Aug 29 '14 at 09:10

1 Answers1

0

use vbs or powershell script depending windows version. a bit of code but native on windows and regex are "available" in it

NeronLeVelu
  • 9,908
  • 1
  • 23
  • 43