0

I work on AIX. I have a lot of sql files that contains the following string:

${DB_USERNAME}.${TABLE_NAME}

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 ".".

I need to change files directly. As I think we should pipe output of grep to sed. remember I am on AIX

1
sed -n -e "s/^${DB_USERNAME}\.${TABLE_NAME}\$/${TABLE_NAME}/" -e p filename

or

sed -i -e "s/^${DB_USERNAME}\.${TABLE_NAME}\$/${TABLE_NAME}/" filename

to change the file directly.

  • 1
    -i is not a standard option in sed and if GNU tools are not install it's very unlikely that it will be supported on AIX – Kiwy Feb 12 '14 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.