I am writing a shell script for editing Modify Aegis Attributes. command i use:
aegis -Change_Attributes -Edit
which opens the vi editor for transferring outside of the changes. I want to do a search and replace:
s/brief_description \= \"none\"\;/brief_description \=
\ "test \" / g
Can I pass them directly to open vi through a script without typing in any of them? I want to save a document (: wq) after editing it.
PS The file is a temporary file created when the command is executed, so I do not know the original path
Edit: I could use sed in this case:
sed -e 's/brief_description\ \=\ \"none\"\;/brief_description\ \=\
\ "test \" \; / g '
Solution (inelegant hack?) To be a "cat" exit from the aegis (setenv VISUAL cat), make changes place the stream with the specified command and save it in a temporary file and use:
aegis -change_attributes -file <temp file>
EDIT2: . , sed
script:
sed -i 's/brief_description\ \=\ \"none\"\;/brief_description\ \=\ \"${DESC}\"\;/g' temp_next.txt
$DESC , out put :
brief_description = "$ {DESC}";
DESC sed, ?
EDIT3:
sed -i 's%brief_description\ \=\ \"none\"\;%brief_description\ \=\ \"'"$DESC"'\"\;%g' temp_next.txt
. (/) % .