The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-04-2007
go4desperado go4desperado is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 7
Post Big (at least to me) sed proble

hi all,
i am again surrounded by a big problem,,,

i have 2 files

file1.txt file2.txt
aaaa xxxx xxxxx
xxxxxxxxxxxxxxx
zzzz zzzz zzz bbb

aaaa xx xxxx xxxx
xxx zzzz zzzz zzz
yyy yy xx xxxxxx

i need to have selection in the script as
#!/bin/sh
for file in file*txt
do
sed -n '/aaa/,/bbb/p' $file >outputfile

done

but i get in outfile is mix of required pattern space {ie aaa--bbb} and unwanted space from {aaaa(II)--EOF}
how to remove this second unwanted pattern spaces from getting printed ...