Re: regex, negations, grep, find and replace (a few questions)



On Sun, 25 Nov 2007, in the Usenet newsgroup alt.os.linux, in article
<bd3885ea-1f0f-4437-88bb-70962513b3de@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
jameshanley39@xxxxxxxxxxx wrote:

NOTE: Posting from groups.google.com (or some web-forums) dramatically
reduces the chance of your post being seen. Find a real news server.

Is there anything like grep that does not have this problem/feature ?
or where that problem/feature can be turned off?

Problem is the multi-line thing. Generally, I'll convert things to a
large single line - how depends STRONGLY on the format of the file I'm
searching through. But look at 'awk' and 'sed' and the fact that
you can use addressing. Another technique for multi-line searches
would be to use grep to find (example) the 'http' key, and use the
'-A 1' option to grab this AND the following line - then slip the
result through 'tr' to delete the embedded newline, then sed, or cut
to strip out the desired pattern.

I heard that it is hard to negate a regex.

No where near enough information.

But grep does not let you do a replace. And On the negation of a
regex.

Man sed

Which programs would , and how?

http://tldp.org/guides.html

Up near the top of that page, you'll find the Advanced Bash Scripting
guide. LOTS of examples and thought provokers.

* Advanced Bash-Scripting Guide
version: 5.1
author: Mendel Cooper, <thegrendel(at)theriver.com>
last update: Nov 2007
available formats:
1. HTML (read online) 2. HTML (read online, single file, 1.9M)
3. HTML (tarred and gzipped package, 560K) 4. PDF (2.2M)
5. PostScript (1.2M) 6. text (513k)
7. PluckerDB (582k)

[compton ~]$ zwc /usr/doc/LDP/abs-guide.txt.gz
49476 191496 1459810
[compton ~]$ echo '49476/60' | bc
824
[compton ~]$

so about 800 pages of material.

Old guy
.