Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AIX using ed to perform in place editing 1

Status
Not open for further replies.

SteveR77

Programmer
Sep 18, 2000
813
0
0
US
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.
 

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
 
[rednose]LKBrwnDBA,


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.
 


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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top