grep
/egrep
. sed
one that will give you grep
-like behavior across multiple lines:-n
suppresses the default behavior of printing every line/foo/{}
instructs it to match foo
and do what comes inside the squigglies to the matching lines. Replace foo
with the starting part of the pattern.:start
is a branching label to help us keep looping until we find the end to our regex./bar/!{}
will execute what's in the squigglies to the lines that don't match bar
. Replace bar
with the ending part of the pattern.N
appends the next line to the active buffer (sed
calls this the pattern space)b start
will unconditionally branch to the start
label we created earlier so as to keep appending the next line as long as the pattern space doesn't contain bar
./your_regex/p
prints the pattern space if it matches your_regex
. You should replace your_regex
by the whole expression you want to match across multiple lines.pcregrep
which can be installed in most of the linux flavour using yum
or apt
.testfile
with contentsed
as well.sed
route, I'll shamelessly steal his suggestion)$f=join(',<>);
: this reads the entire file and saves it's contents (newlines and all) into the variable $f
. We then attempt to match foonbar.*n
, and print it if it matches (the special variable $&
holds the last match found). The ///m
is needed to make the regular expression match across newlines.-0
sets the input record separator. Setting this to 00
activates 'paragraph mode' where Perl will use consecutive newlines (nn
) as the record separator. In cases where there are no consecutive newlines, the entire file is read (slurped) at once.foo
:while(<>){$all .= $_}
This loads the entire standard input in to the variable $all
while($all =~
While the variable all
has the regular expression../^(foo[^n]*nbar[^n]*n)/m
The regex: foo at the beginning of the line, followed by any number of non-newline chars, followed by a newline, followed immediately by 'bar', and the rest of the line with bar in it. /m
at the end of the regex means 'match across multiple lines'print $1
Print the part of the regex that was in parenthesis (in this case, the entire regular expression)s/^(foo[^n]*nbar[^n]*n)//m
Erase the first match for the regex, so we can match multiple cases of the regex in the file in questiontestfile
contains:sift -m '<description>.*?</description>'
(show the lines containing the description)sift -m '<description>(.*?)</description>' --replace 'description='$1' --no-filename
(extract and reformat the description)Perl-regexp
parameter P
will do this job.(?s)
called DOTALL modifier which makes dot in your regex to match not only the characters but also the line breaks. /foo/{
is triggered when line contains 'foo' n
replace the pattern space with next line, i.e. the word 'here' b gotoloop
branch to the label 'gotoloop' :gotoloop
defines the label 'gotoloop' /bar/!{
if the pattern doesn't contain 'bar' h
replace the hold space with pattern, so 'here' is saved in the hold space b loop
branch to the label 'loop' :loop
defines the label 'loop' N
appends the pattern to the hold space.:gotoloop
We are now at step 4, and loop until a line contains 'bar'/bar/
loop is finished, 'bar' has been found, it's the pattern space g
pattern space is replaced with hold space that contains all the lines between 'foo' and 'bar' that have saved during the main loopp
copy pattern space to standard output
|
More by: relevance | popularity | freeware | mobile | title |
1 | EZ-FileIndex |
---|---|
A powerful file-indexing tool Easy and efficient file management Locate your files quickly The file index can be easily categorized, organized, and manipulated Create index files for all your files and documents using .. | |
Size: 1.2 MB, Price: USD $19.00 , License: Shareware, Author: Hu xiao qi (go-assistant.com) |
2 | Recovery Toolbox File Undelete Free |
---|---|
If you have inadvertently deleted a file from your NTFS-formatted hard drive, USB stick or memory card and desperately need it as soon as possible, all you need is Recovery Toolbox File Undelete Free - a 100% free file recovery tool! When a file is deleted, .. | |
Size: 2.4 MB, Price: Free, License: Freeware, Author: Recovery Toolbox, Inc. (recoverytoolbox.com) |
3 | File Splitting Tool |
---|---|
File splitting tool is used to break divide large file into numerous smaller chunks as per your requirement and also merge these chunks into original form without any type of data loss. File splitting tool is used to break divide large file into numerous .. | |
Size: 297.0 KB, Price: USD $14.95 , License: Shareware, Author: Split Merge (splitmerge.us) |
4 | Unistal Excel Recovery |
---|---|
Unistal Excel Recovery Software is a professional excel file repair tool to fix excel documents & repair corrupt excel files. Unistal Excel Recovery Software is a professional excel file repair tool to fix excel documents & repair corrupt excel .. | |
Size: 1.7 MB, Price: USD $35.00 , License: Shareware, Author: Unistal Data Recovery (unistal.com) | |
Corrupt, Damaged, Documents, Excel, File, Files, Fix, Recovery, Recovery, Repair, Repair, Software, Tool, Xls |
5 | Zip File Recovery |
---|---|
Want to know the excellent way to extract the Zip file then use of Zip file recovery software which is a most demanding utility to repair the corrupt Zip file. The zip repair tool is designed with sophisticated scanning technique to repair Zip file. .. | |
Size: 812.5 KB, Price: USD $20.00 , License: Shareware, Author: Zip RepairTool (ziprepairtool.com) | |
Extract Zip, Open Zip File, Repair Corrupt Zip File, Repair Zip File, Zip File Recovery, Zip File Recovery Software, Zip File Repair Tool, Zip Recovery, Zip Repair, Zip Repair Tool |
6 | BizBee File Split Merge Pro |
---|---|
BizBee File Split Merge Pro is a 'two-in-one', simple to use software tool to split virtually any files and merge the split files without any software. This tool can also merge any text files as the user like. While the split tool is useful .. | |
Size: 1.5 MB, Price: USD $17.00 , License: Shareware, Author: BiizBee (bizbee.com.au) | |
File Merge, File Split, Join Files, Merge, Merge Files, Split, Split File, Tool |
7 | Recover FAT Partition |
---|---|
Windows Vista FAT partition file salvage tool is a read only and non destructive utility which recovers data from damaged hard disk of any capacity. Windows Vista FAT partition file salvage tool is a read only and non destructive utility which recovers .. | |
Size: 686.0 KB, Price: USD $69.00 , License: Free to try, Author: Unerase Unformat (drpu.net) | |
Application, Backup, Corrupted, Crashed, Damaged, Data, Dbr, Deleted, Disk, Drive, Erased, Fat, File, Folder, Formatted, Gif, Hard, Lost, Mbr, Mft |
8 | QuickSearcher |
---|---|
QuickSearcher is a file search tool. QuickSearcher is a file search tool. Decided superiority is Preview for text search (as well as preview for graphical files), ability to search within several folders (multi directory search) or within search results, .. | |
Size: 491.5 KB, Price: Free, License: Freeware, Author: AKS-Labs (sortdesktop.com) | |
Context, Directory, Favorite, File, Find, Folders, Mp3, Ms, Multi, Office, Preview, Search, Text, Tool, Utility |
9 | MultiFind Pro |
---|---|
Multifind Pro is an advanced file search tool for Windows. Multifind Pro is an advanced file search tool for Windows. It allows searching for files by text string, regular expression, file size, file date and more. Many popular file formats are supported .. | |
Size: 778.2 KB, Price: USD $24.95 , License: Shareware, Author: Midlinesoft (midlinesoft.com) | |
File, File, Find, Multiple, Search, Search, Text, Tool, Utility |
10 | Best Zip Corrupt Repair Tool |
---|---|
Download best Zip corrupt repair tool in your computer hard-disk. With support of this application, you can recover corrupt zip file and extract corrupt zip file from invalid zip file. Microsoft Company is consolidated a compressed (zipped) archive in .. | |
Size: 812.0 KB, Price: USD $20.00, EUR 15 , License: Shareware, Author: Open Damage Zip File (en.ziprepairtool.com) | |
Best Zip Corrupt Repair Tool, Fix Damage Zip File, Recover Corrupt Zip File, Recovery Of Corrupt Zip File, Zip File Reader Tool |
11 | Fileshredder Tool |
---|---|
File shredder tool are excellent way of deleting files and folders from computer’s hard disk beyond the point of recovery. Such tools are capable of wiping away temporary files; recycle bin contents and even Internet cookies with accuracy. Pressing .. | |
Size: 4.4 MB, Price: USD $29.00, INR 1800 , License: Shareware, Author: Fileshredder (fileshreddersoftware.com) | |
Delete File, Delete Files, Delete Files Permanently, Document Shredding, File Shredder, Fileshredder Tool, Secure Delete, Secure Erase, Wipe Free Space |
12 | PowerPoint Repair Kit |
---|---|
PowerPoint Repair Kit is advanced Microsoft PowerPoint repair tool designed for recovering damaged PPT and PPTX file. This Microsoft PowerPoint repair software is compatible with a broad range of PowerPoint file formats, and can be used in all major .. | |
Size: 3.4 MB, Price: USD $27.00, USD 27 , License: Shareware, Author: Repair Kit, Inc. (microsoftoutlook.repair) | |
How To Repair Powerpoint File, How To Repair Powerpoint File Damaged, Microsoft Powerpoint Repair Tool, Power Point Repair, Powerpoint File Repair, Powerpoint File Repair Tool, Powerpoint Repair Tool, Repair Powerpoint, Repair Powerpoint File |
13 | Remo Zip for MAC |
---|---|
Remo ZIP for MAC is the most recommended file compressor for MAC. The tool simplifies the process of sending large files over internet by compressing them into zip files with excellent precision. File compression offers a lot of advantages that makes .. | |
Size: 5.1 MB, Price: USD $29.97 , License: Demo, Author: Remo Software (remosoftware.com) | |
Compress Files Mac, Create Zip File Mac, File Compression Tool, File Compressor For Mac, Zip Compressor For Mac, Zip File Mac |
14 | Link Maven |
---|---|
Link Maven is a parallel link file transfer tool for Windows 95 - Vista. Connect two PCs together with a Laplink/Interlnk compatible cable and copy, move, & delete files and directories between them. Also connects to DOS/Win 3.1 PCs. Link Maven is a .. | |
Size: 969.0 KB, Price: USD $29.95 , License: Shareware, Author: Briggs Softworks (briggsoft.com) | |
File, Interlnk, Laplink, Link, Maven, Parallel, Transfer |
15 | AnalyseSpider |
---|---|
AnalyseSpider is a Log File Analyzer tool with a wealth of analysis to help you AnalyseSpider is a powerful Web Log File Analyzer tool with a wealth of analysis to help you optimize your site.This tool can also help you to see if your Web site promotion .. | |
Size: 7.5 MB, Price: USD $49.95 , License: Shareware, Author: Jgsoft Associates (ip2country.net) | |
Analyser, Analyze, Analyzer, Analyzis, Http Logs, Log Analyser, Log Analysis, Log Analyzer, Log File Analysis, Log File Analyzer, Log Files, Loganalysis, Logfile Analyzer, Logfiles, Raw Logs, Raw Server Logs, Report, Reports, Search, Server Logs |
16 | Hex Editor |
---|---|
Hex Editor Software - Binary File Editing Tool for Windows. Edit your exe code. Hex Editor Software - Binary and Hex file editing tool for Windows with Multi-Window, Multi-Document Interface, Text Viewer, Advanced Search and Replace features. Edit your .. | |
Size: 2.0 MB, Price: USD $24.99 , License: Shareware, Author: HHD Software (hhdsoftware.com) | |
Bin, Code, Download, Dumps, Edit, Editing, Editor, Exe, File, Hex, Hex Dump, Hexedit, Hexeditor, Reader, Software, Text, Viewer, Windows |
17 | Sky Commander |
---|---|
Sky Commander is a new file manager for Windows. In the first place, the program was designed as a file management tool for users who do not have a lot of experience working with the computer, but whose needs are constantly increasing. Are you accustomed .. | |
Size: 1.7 MB, Price: USD $39.99 , License: Shareware, Author: NMZ labs (nmzlabs.com) | |
Ace, Archive, Archiver, Cab, File Disk Managment, File Manager, File Splitter, Ftp, Multi-rename, Rar, Zip |
18 | BearShare Turbo |
---|---|
BearShare Turbo is a free P2P file sharing tool that enables you to search for, download, and share MP3, MPEG, AVI, ASF, MOV, JPEG, GIF, and all other file types with everyone on the global Gnutella peer-to-peer informationnetwork. BearShare Turbo is .. | |
Size: 4.2 MB, Price: Free, License: Freeware, Author: SharingZone (sharingzone.com) | |
Ares, Bearshare Turbo, File, File Sharing, Free P2p Clients, Movies, Mp3 Downloads, Music, P2p, Sharing, Songs, Video |
19 | PAD Server Windows |
---|---|
Online PAD- file generation tool. Import, create, manage and update your PAD- files and PPP- files from your personal PAD Service account. Hundreds of software authors around the world are already using PAD Service to manage their shareware listings .. | |
Size: 345.7 KB, Price: USD $19.95 , License: Shareware, Author: Pad Service Shareware Network (pad-service.com) | |
Asp, Distribute Software, Manage Software, Pad, Pad File, Publish Software, Shareware, Shareware Affiliate, Software, Software Author, Software Vendor |
20 | Hyper File Searcher |
---|---|
Hyper File Searcher is a tool which can search all files in your computer in an extreme high speed. Based on the database search engine, this tool can do a search ONLY IN SECONDS. Hyper File Searcher is a tool which can search all files in your computer .. | |
Size: 1.4 MB, Price: USD $19.95 , License: Demo, Author: Exalogic.com (exalogic.com) | |
Fast, File, Search |
21 | PAD Server OS X |
---|---|
Online PAD- file generation tool. Import, create, manage and update your PAD- files and PPP- files from your personal PAD Service account. Hundreds of software authors around the world are already using PAD Service to manage their software listings Online .. | |
Size: 655.4 KB, Price: USD $19.95 , License: Commercial, Author: Pad Service Software Network (pad-service.com) | |
Affiliate, Asp, Author, Distribute, Manage, Pad, Pad File, Publish, Shareware, Software, Vendor |
22 | Multi FTP Sync |
---|---|
Mulit FTP Sync is a real-time file synchronization tool that can automatically synchronize the local file system to one or more FTP Servers without any user intervention.It is useful in website synchronization, remote backup. Mulit FTP Sync is a real-time .. | |
Size: 1.1 MB, Price: USD $29.00 , License: Shareware, Author: Coolmasoft (coolmasoft.com) | |
Auto Sync, Data Synchronization, File Sync, File Synchronization, Ftp Backup, Ftp Sync, Ftp Synchronization, Ftp Synchronize, Mirror Site, Remote Backup, Synchronization, Synchronize, Synchronize File, Synchronize Folder, Website Synchronization |
23 | BareTailPro |
---|---|
A real-time log file monitoring tool: * Real-time file viewing * Follow tail mode (like tail -f on Unix) * Regular expression text search * High-performance search algorithm * Filter tail mode (include or exclude lines) A real-time log file monitoring .. | |
Size: 298.0 KB, Price: USD $35.00 , License: Demo, Author: Bare Metal Software Pty Ltd (baremetalsoft.com) | |
Baretail, File, Follow, Highlight, Log, Real-time, Tail, Viewer, Win32, Windows |
24 | Nucleus Kernel Data Recovery Software |
---|---|
It is a robust data recovery software and file undelete tool for FAT and NTFS file systems. An easy to use data recovery utility for Windows 98/Me/NT/2000/XP/2003. Nucleus Kernel for FAT and NTFS is the most powerful data recovery software and file .. | |
Size: 1.8 MB, Price: USD $69.00 , License: Demo, Author: Nucleus Data Recovery (nucleustechnologies.com) | |
Data Recovery Software, Deleted File Recovery, Fat Data Recovery, Formatted Hard Drive Data Recovery, Ntfs Data Recovery, Partition Recovery, Recover Data From Crashed Disk, Recover Files, Undelete, Windows Data Recovery Software |
25 | Nucleus Windows Data Recovery Software |
---|---|
It is a robust data recovery software and file undelete tool for FAT and NTFS file systems. An easy to use data recovery utility for Windows 98/Me/NT/2000/XP/2003. Nucleus Kernel for FAT and NTFS is the most powerful data recovery software and file .. | |
Size: 2.0 MB, Price: USD $79.00 , License: Demo, Author: Nucleus Data Recovery (nucleustechnologies.com) | |
Deleted File Recovery, Fat Data Recovery, Formatted Hard Drive Recovery, Formatted Partition Recovery, Ntfs Data Recovery, Partition Recovery, Recover Crashed Disk Data, Recover Data, Recover Files, Undelete, Windows Data Recovery Software |
More by: relevance | popularity | freeware | mobile | title |