| Date: Wed, 27 Jul 2005 21:19:24 +0000
| From: Paul Biggar <paul.biggar at gmail.com>
|
| grep can find two words one after the other by doing 'grep "word1
| word2"'. Does anybody know a way of making this return a case where
| word1 is at the end of one line, and word2 is at the start of the
| next.
one easy(?) solution is to use GNU awk:
gawk -vRS='' '/word1[[:space:]\n]+word2/'
not sure if that will work with other AWKs or not.
note, however, the above prints the entire (La)TeX
paragraph — I'm assuming here yer paragraphs are
separated by empty lines (and not, e.g., \par) —
that contains the two adjacent words, not just the
one or two lines containing the words.
a more sophisticated AWK script can be written to
print just the one or two lines.
| On a similar note, I'm looking for a diff/merge tool that takes the
| flow of a paragraph into account. I'm trying to merge two slightly
| different copies of the same latex document. I saw texdiff, but its
| not exactly what I'm looking for, which would be more like a the
| standard diff tool. I also looked at wdiff, but it doesn't really
| merge things, and looks like it will be hard to use. Can anyone
| suggest better?
hum. since all unescaped whitespace is the same to
(La)TeX, you could, perhaps, put each word (which is
not in a %comment) on a separate line, and then just
use diff(1)? the result would not be very friendly
to human editors .... ;-(
b.t.w., where is `texdiff'? I have never heard of it.
cheers!
-blf-
--
Experienced (20+ yrs) kernel/software Eng: | Brian Foster Montpellier,
• Unix, embedded, &tc; • Linux; • doc; | blf at utvinternet.ie FRANCE
• IDL, automated testing, process, &tc. | Stop E$$o (ExxonMobile)!
Résumé (CV) http://www.blf.utvinternet.ie | http://www.stopesso.com
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!