- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: sed ????
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 02:07 PM
06-17-2002 02:07 PM
Hello,
I am working on a project that require migration of a lot of scripts from an SGI IRIX to an HP-UX environment. These scripts may have a lot of statements that include "rsh" or other IRIX specific PATH statements.
I would like to automate this migration as much as possible for example using sed to replace the word"rsh" with HP-UX "remsh".
Can any one suggest a scripts that can do this change for me.
Any help will be greatly appreciated.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 02:29 PM
06-17-2002 02:29 PM
Solutionperl -p -i.bkup -e 's/rsh/remsh/g' file1 file2 ...
Believe it or not, you are done and you have file1.bkup file2.bkup as well. If you leave off the .bkup (just use -i) then no backup will be created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 02:30 PM
06-17-2002 02:30 PM
Re: sed ????
using sed from the command line
sed s/rsh/remsh/g
will replace rsh with remsh in
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 02:38 PM
06-17-2002 02:38 PM
Re: sed ????
To action this on a number of files in a directory
#!/usr/bin/sh
for file in *
do cat $file | sed s/rsh/remsh/g > newfile
cp newfile $file
done
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 02:52 PM
06-17-2002 02:52 PM
Re: sed ????
I do like both solutions athough I really did not need to make any backup copies of original files in the perl example but I like the other shell sed solution...It worked for me....
I think I will go with that.
Thank you all very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 03:12 PM
06-17-2002 03:12 PM
Re: sed ????
perl -p -i -e 's/rsh/remsh/g' *
Then every file in the directory is done AND permissions/modes are preserved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 03:20 PM
06-17-2002 03:20 PM
Re: sed ????
Sorry Guys,..I really don't mean to take the easy way out but I am not really scripting guru kind of guy ..
This gave me another idea that I need to take care of also...
Same thing except
checking a certain custom host file and doing remote shell
server1
server2
server3
etc..
to that host then updating .rhost file from a certain host1 to host2...
Please don't take this as me being lazy to learn scripting.. I really need this done by tomorrow....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 03:30 PM
06-17-2002 03:30 PM
Re: sed ????
You can assign points for the answers that have helped you as a token of appreciation
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 03:37 PM
06-17-2002 03:37 PM
Re: sed ????
Please forgive me .. I did not mean to un appreciative ..
Everything posted here for me was very very helpful ..
Thank you for your help ...
Really ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 03:43 PM
06-17-2002 03:43 PM
Re: sed ????
To perform tasks on multiple hosts
for eg - to list resolv.conf file on a number of hosts - presuming you have .rhosts setup
Have a file containing the hostnames /tmp/hostnames
#!/usr/bin/sh
LOG=/tmp/resolv.log
HOSTS=/tmp/hostnames
for file in $(cat $HOSTS)
do
echo $file >> $LOG
remsh $file -n 'll /etc/resolv.conf' >> $LOG 2>&1
done
Manipulate the above to do what you like
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 03:55 PM
06-17-2002 03:55 PM
Re: sed ????
Now I know..I just went head and did..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2002 02:32 AM
06-19-2002 02:32 AM
Re: sed ????
I like Clay's use of the perl syntax.
You can also use ed rather than sed:
ed filename << EOF
g/rsh/s/rsh/remsh/
w
q
EOF
Cheers,
Joseph.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 03:26 PM
07-11-2002 03:26 PM
Re: sed ????
Sorry I did not get back for feedback soon...I have been kind of busy...
Just a feedback ..I have used Clay's method ..It worked really welll ...
Thanks Clay for the help and thank you all for your contributions...