Computing.Net > Forums > Disk Operating System > Extracting blocks of text in from text files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Extracting blocks of text in from text files

Reply to Message Icon

Name: qasem
Date: July 21, 2009 at 15:17:26 Pacific
OS: Windows XP
Subcategory: General
Comment:

Hello,
I'm trying to write a simple DOS *.cmd file that would search for a line that has a specific word in a text file, then copies that line and 30 lines after it to a new text file, The Original text file may contain multiple instances of the word of interest and I want all of these copied to the new file.

Any help, any one??
Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: July 25, 2009 at 07:25:33 Pacific
Reply:

look at the below sample of file input, and say you are looking for "myword"

this is a line
myword here
this is next line
another myword here
this is another next line 
blah

there are 2 "mywords", so will there be 2 files each ? one will contain

myword here
this is next line
another myword here
this is another next line 
blah

and the other file will contain

another myword here
this is another next line 
blah

better explain clearly your requirement.

GNU win32 packages | Gawk


0

Response Number 2
Name: qasem
Date: July 27, 2009 at 10:16:45 Pacific
Reply:

Thanks for the response:

I found a way to do what I want using a macro within my text editor.

Thanks


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Extracting blocks of text in from text files

extract text block from a text file www.computing.net/answers/dos/extract-text-block-from-a-text-file/16564.html

Read in from text file www.computing.net/answers/dos/read-in-from-text-file/10895.html

Reading text from a file www.computing.net/answers/dos/reading-text-from-a-file/9080.html