Welcome Guest.   Make a donation to an author on the site September 22, 2014, 03:17:30 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Check out and download the GOE 2007 Freeware Challenge productivity tools.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: extract lines containing  (Read 1774 times)
kalos
Member
**
Posts: 1,022

View Profile Give some DonationCredits to this forum member
« on: September 23, 2013, 04:55:17 PM »

hello
can you tell me please how to search inside a bunch of text files and "extract'' all the lines that contain *something* in a list into a new text file?
thanks!
Logged
AndyM
Charter Member
***
Posts: 616


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #1 on: September 23, 2013, 07:43:30 PM »

from a command line you can issue the Find command and redirect the results to a text file

if you want to use wildcards I think you have to use the Find command inside a For statement

look up Find, For, and redirecting output in a Command Line reference
Logged
x16wda
Supporting Member
**
Posts: 465


what am I doing in this handbasket?

see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: September 23, 2013, 07:45:33 PM »

Quote
qgrep -y findme *.txt > results.txt

That's on a Windows platform with qgrep (from one of the old resource kits).  The -y means case insensitive, findme is the string to find (you could look for multiple words with "one two" instead, it will find lines with either), you're searching through all the .txt files and directing the output to a file.

Of course there are more options with a real grep, depending on your platform.
Logged

vi vi vi - editor of the beast
4wd
Supporting Member
**
Posts: 3,334



see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: September 24, 2013, 12:19:43 AM »

grepWin



1) Directory
2) Text search
3) Text to search for
4) File filter
5) Select to display Content

When it's finished, select all the results and copy to clipboard, you can then paste them into a file.
Logged

I do not need to control my anger ... people just need to stop pissing me off!
AbteriX
Charter Honorary Member
***
Posts: 1,050


Member #520

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: September 24, 2013, 01:11:15 AM »

from a command line you can issue the Find command and redirect the results to a text file

if you want to use wildcards I think you have to use the Find command inside a For statement

look up Find, For, and redirecting output in a Command Line reference

Nowadays we even have 'findstr' on Win7:

[copy or print]
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P]
        [/F:Datei] [/C:Zeichenfolge] [/G:Datei] [/D:Verzeichnisliste]
        [/A:Farbattribute] [/OFF[LINE]] Zeichenfolgen
        [[Laufwerk:][Pfad]Dateiname[ ...]]
http://ss64.com/nt/findstr.html


C:\>FindStr /R myregexsearchpattern C:\Temp\*.txt > C:\Temp\results.txt


- - -

hehehe, the circle closes   tongue :

Quote
Along the way, qgrep somehow changed its name to findstr.
http://blogs.msdn.com/b/o.../2012/11/28/10372436.aspx
.
« Last Edit: September 24, 2013, 01:28:23 AM by AbteriX » Logged

Greetings, Stefan.
David1904
Supporting Member
**
Posts: 39

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: September 25, 2013, 04:42:36 PM »

Available on TUCOWS

TextHarvest 3.00.00
file size: 696.39 KB

As TextHarvest copies a text file it can keep, delete, skip, edit or reformat lines that contain specified strings of text.
Logged
saralynn
Participant
*
Posts: 4

View Profile Give some DonationCredits to this forum member
« Reply #6 on: October 24, 2013, 05:25:32 PM »

TextPad has a "Find in Files" command that lets you search content of files within your specified path.
Search pattern can be a regular expression & you can limit which type(s) of files are searched.
Although it doesn't directly export the search results to a new file, you can easily SaveAs the results output.
(you'll probably first want to search/replace to remove the filename+lineNumber from start of each line)
Logged
ur1sn00per
Charter Member
***
Posts: 19

View Profile Give some DonationCredits to this forum member
« Reply #7 on: December 16, 2013, 04:58:36 PM »

http://textmechanic.com/ online text manipulation tool
Logged
alandavid
Participant
*
Posts: 1


View Profile Give some DonationCredits to this forum member
« Reply #8 on: December 17, 2013, 12:57:51 AM »

grepWin
 (see attachment in previous post)
1) Directory
2) Text search
3) Text to search for
4) File filter
5) Select to display Content

When it's finished, select all the results and copy to clipboard, you can then paste them into a file.
Thanks for share such a good information. i am new in this but now i got it.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.036s | Server load: 0.07 ]