INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

AIX using ed to perform in place editing

AIX using ed to perform in place editing

(OP)
I am battling with an old AIX server and old version of KSH to create a script that will toggle comments in a file
in order to update which server is active.

The issue is the here document and ed command do not execute. The script runs without errors but the subtitution that I expect to happen isn't.

Below is the block of code related to ed and the here document:

ed $F_NAME <<EOF
1,\$s/#10.7.1.239 genesis jde/10.7.1.239 genesis jde/g
1,\$s/10.7.1.234 genesis jde/#10.7.1.239 genesis jde/g
w
EOF


Thank you in advance for your assistance.

I.T. where a world of choas and confusion comes down to nothing but 1s and 0s.

RE: AIX using ed to perform in place editing


You may need to use "ex" instead of "ed" and also notice the escaping of '#' symbol:

CODE

ex $F_NAME <<EOF!
1,\$s/\#10.7.1.239 genesis jde/10.7.1.239 genesis jde/g
1,\$s/10.7.1.234 genesis jde/\#10.7.1.234 genesis jde/g
w
q
EOF! 
3eyes

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

RE: AIX using ed to perform in place editing

(OP)
rednoseLKBrwnDBA,


Thank you. I escaped the # for the subtitution but it is still not doing the subtitutions. I will attempt the older global replacement reference and if that fails then will see what happens using ex as you have suggested.

The ironic part is in Suse Linux the script I created works without any issues. However, it is good to knock the rust off and battle the old AIX environment.


Thank you again for your assistance with this and make it a great day.

I.T. where a world of choas and confusion comes down to nothing but 1s and 0s.

RE: AIX using ed to perform in place editing



On AIX use "ex" (EEEE - X)instead of "ed"
noevil

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close