[ale] text extraction, multiple matches per line, sed preferred.

Ed Cashin ecashin at noserose.net
Sat Sep 13 15:33:10 EDT 2008


2008/9/13 Jim Kinney <jim.kinney at gmail.com>:
> sed -e 's/*"(*?)"*/$1\n/g'
>
> maybe. Not 100% on the (*?)

I have GNU's sed, but I think this below stuff is backwards
compatible with old-school sed, and maybe you could build
a sed script out of it.  (The last "sed -n l" (with an "L") is just
to check whether they're carriage-return separated.  They're
not.  As you can see, there are newline characters as well.  ;)

ecashin at meili:~$ sed 's!file name=!file at name=!g' /tmp/data | sed 's!
*!\n!g' | sed -n '/.*file at name="/{ s!!!; p; }' | sed 's!"!\r!' | sed
-n l
blah.blah.ext\r$
blah2.blah.ext\r$
blah3.blah.ext\r$
blah4.blah.ext\r$
blah.blah5.ext\r$
blah6.blah.ext\r$
blah7.blah.ext\r$
blah8.blah.ext\r$
ecashin at meili:~$

-- 
 Ed Cashin <ecashin at noserose.net>


More information about the Ale mailing list