[EMAIL PROTECTED] wrote:
file one.txt:
blah.blee text
blah.blee text
blah.blee text
blah.blee text

file two.txt:
hud
hud
hud
foo
foo
foo

I want to search and replace "blah.blee" with just "blah" so, in sed:

sed "s/blah.blee/blah/g" one.xml >output.txt

Probably need to to s/blah\.blee/blah/g actually, but you knew that.

then I want to insert output.txt into file two.txt in between the hud
sections and the foo sections.

(File two.txt is dynamically generated and the number of the hud and foo
entries changes, but there will always be at least one hud and one foo.)

Is there a nifty way to insert one file in the middle of another using
sed/awk/other shell script?

awk is a little programming language complete with file I/O, loops, and conditionals, so I'm sure you can do it, probably in less than 10 lines of awk. I'm too lazy to read the man page or go borrow the Aho, Kernighan, and I forget who the W is, book from the guy next to me and write it for you, but I assure you it can be done.


Bryan

____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to