tech.gate.io blog
grep for a whole paragraph
what to do if you want to grep for a string in a file, and want to get the whole stanza/paragraph where the string was found in?
there is a very simple AIX-solution, and a bit more complicated one with sed:
a sample textfile:
# cat testfile start 1 value end start 2 end start 3 foo end start 4 end
- AIX grep
# grep -p foo testfile start 3 foo end
- sed
# sed -e '/./{H;$!d;}' -e 'x;/foo/!d;' testfile
start
3
foo
end
Sidebar
Wiki
Sidebar
Last blog posts
-
tivoli itm 6.2 change agent hostname to other then original system hostname
Tue 15 of Mar., 2011 19:17 CET
-
X11 secure display forwarding via ssh error
Tue 15 of Mar., 2011 19:03 CET
-
Android 2.2.1 delay between accepting call and actually hearing the caller
Tue 15 of Mar., 2011 18:50 CET
-
AIX: Get PVID directly from hdisk using od
Thu 15 of Apr., 2010 15:25 CEST
-
Power Blade: Add additional vscsi adapters to lpar / vhosts to vio server
Wed 24 of Mar., 2010 09:49 CET
-
Bug in xymon 4.3.3 Beta 2 splitncv
Tue 23 of Feb., 2010 10:11 CET
-
Analysing screen and browser window sizes reported by AWStats using R
Thu 18 of Feb., 2010 14:14 CET
-
Nagios on FreeBSD
Wed 27 of Jan., 2010 13:24 CET
-
Freebsd sendmail via Exchangeserver
Thu 17 of Dec., 2009 10:39 CET
-
xymon netapp vfiler quota monitoring
Tue 24 of Nov., 2009 17:55 CET
Last blog post comments
- xymon netapp vfiler quota monitoring: rvksjfq sjmgafs 01:26 CEST
- Use Windows as router / NAT traffic: vnvrfihp muygzxbi Sat 19 of May, 2012 16:18 CEST
- mount nfs v3 share under Solaris 10: kdvwtux xqowacnm Sat 19 of May, 2012 04:21 CEST
- Unix Color Terminal: cbeusw ejbpsnr Sat 19 of May, 2012 01:29 CEST
- AIX: Get PVID directly from hdisk using od: buy penis enlargement penis_enlargement Fri 18 of May, 2012 15:14 CEST
- AIX: Get PVID directly from hdisk using od: risperdal risperdal Fri 18 of May, 2012 13:00 CEST
- AIX: Get PVID directly from hdisk using od: cheap phen375 phen375 Wed 16 of May, 2012 18:30 CEST
- AIX: Get PVID directly from hdisk using od: Good info Pharmk935 Mon 14 of May, 2012 23:06 CEST
- Unix Color Terminal: Good info Pharmd119 Sun 13 of May, 2012 15:49 CEST
- Test network throughput without disk or cpu distortion: Good info Pharmd585 Sun 13 of May, 2012 06:01 CEST

1 2 3 4 5 6 7
Post new comment