/ Published in: Bash
                    
                                        As portrayed by the example found in the [Advanced Bash Scripting guide](http://tldp.org/LDP/abs/html/here-docs.html) this demonstrates a few techniques
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
 #!/usr/bin/env bash # Replace all instances of "Smith" with "Jones" #+ in files with a ".txt" filename suffix. ORIGINAL=Smith REPLACEMENT=Jones for word in $(fgrep -l $ORIGINAL *.txt) do # ------------------------------------- ex $word <<EOF :%s/$ORIGINAL/$REPLACEMENT/g :wq EOF # :%s is the "ex" substitution command. # :wq is write-and-quit. # ------------------------------------- done
Comments
                    Subscribe to comments
                
                