I have a text file which defines the values of some important variables. Such a text file is used for several simulations. I need to change the value of one parameter in the file:
ap       =   24.1, to a smaller value 3.
what I do is to use the sed. 
sed 's/to_be_replace/replaced_result/' text file
mv text_file tt
sed 's/ap       =   24.1,/ap       =   3,/p' tt > text_file 
then the old text file is modified with the ap value !
 
Aucun commentaire:
Enregistrer un commentaire