Extract a specific line from text?

September 20, 2011 at 11:20:42
Specs: Windows 7
I have a text file, 'test1.txt'. It contains data in the following format:

sample line 1
sample line 2
sample line 3
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKcAAAFpCAYAAAD5gzicAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEw5QkVYWXZKXTE1fE4xYkZLZzBaY3tZLS0==
sample line 4
sample line 5
sample line 6

How can i extract the text between, which it starts from "data:image/png" and ends with "==" ????
The lines will change in each text files. Please tell me how i can extract the output to a new text document via batch?

Thanks in advance.


See More: Extract a specific line from text?

Report •


#1
September 20, 2011 at 12:13:40
type test1.txt | find "data:image/png" >> newtest1.txt


Report •

#2
September 20, 2011 at 12:33:30
No. I want to know how to extract the text between,
"data:image/png" and "=="
????

Report •

#3
September 20, 2011 at 14:12:29
@echo off & setlocal EnableDelayedExpansion
for /F %%j in ('type test1.txt ^| find "data:image/png"') do (
  set row=%%j
  set row=!row:data:image/png=!
  set row=!row:~0,-2!
  echo.!row!>> newtest.txt
)


Report •

Related Solutions


Ask Question