1
first of all please execuse my ignorance on UNIX. I am quite new.
I have lot many sql files that contains following string
${DB_USERNAME}.${TABLE_NAME}
Can anyone please tell me how could I change it in each file so that it remains only
${TABLE_NAME}
I have tried following pattern of sed.
sed 's/^[^\.]\+\.//'
But it returns only ".".
Please tell me whole combination of grep and sed.
I need to change files directly. As I think we should pipe output of grep to sed. remember I am on AIX
Thanks. that works but I need to change files directly. As I think we should pipe output of grep to sed. – Ahmad – 2014-02-12T11:12:22.177
If you need to change the file directly use in-place editing:
sed -i '' -e 's/…//g' input-file
orsed -i -e 's/…//g' input-file
depending on your sed version. – slhck – 2014-02-12T11:16:19.423I am on AIX.:(.. – Ahmad – 2014-02-12T11:17:24.967
1
If your
– slhck – 2014-02-12T11:19:54.523sed
does not support in-place editing, simply use an intermediate file. Or usesponge
from Moreutils withsed -e … file | sponge file
.