I've tried using sed to replace an SELECT with BELECT in a file:
sed 's/SELECT/BELECT/g' add_pixel.sql | diff - add_pixel.sql
Gives me:
22c22
< BELECT MAX(ID) INTO max_id FROM pixels;
---
> SELECT MAX(ID) INTO max_id FROM pixels;
36c36
< '(BELECT id FROM pixels WHERE pixel_id=''', new_pixel_id,
---
> '(SELECT id FROM pixels WHERE pixel_id=''', new_pixel_id,
47c47
< DELIMITER ;
---
> DELIMITER ;
\ No newline at end of file
This was confirmed by wc - the fiel after sed is one line shorter than the original.
Why did sed's 's/SELECT/BELECT/g' removed the newline from the last line of the file?
add_pixel.sqlfile for further testing? – izx Aug 8 '12 at 8:04