Você pode usar sed
:
sed 's/^PS1="\$(hostname).*\${PROMPT}.*/PS1="${FGOLD}$(hostname):${LOGNAME}:\\${PWD} ${PROMPT} ${NORMAL}"/'
Conteúdo do arquivo:
PS1="$(hostname):${LOGNAME}:\${PWD} ${PROMPT} "
PS1="${FGOLD}$(hostname):${LOGNAME}:\${PWD} ${PROMPT} ${NORMAL}"
PS1=abd
PS1="$(hostname):$LOGNAME:\$PWD $PROMPT "
export PS1 LANG
Linhas que quero alterar:
PS1="$(hostname):${LOGNAME}:\${PWD} ${PROMPT} "
linha de substituição:
PS1="${FGOLD}$(hostname):${LOGNAME}:\${PWD} ${PROMPT} ${NORMAL}"