- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- help with this script requirement
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
10-23-2009 08:43 AM
10-23-2009 08:43 AM
help with this script requirement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2009 08:50 AM
10-23-2009 08:50 AM
Re: help with this script requirement
The first part is easy if the code is in a text file.
diff
You can route that into a file and take actions to insert the code into a new file with tools like sed
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2009 09:14 AM
10-23-2009 09:14 AM
Re: help with this script requirement
Have a look at the manpages for 'diff' :
http://docs.hp.com/en/B2355-60130/diff.1.html
There are even examples for you therein.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2009 09:16 AM
10-23-2009 09:16 AM
Re: help with this script requirement
You can use # sdiff -b oldcode newcode
view the difference and parse that output & combine a new file with updated code.
Check this out if you are looking something like this:,
http://bash.cyberciti.biz/file-management/send-http-code-301-moved-permanently-redirection/
If you have any example it would be great,
Hth,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2009 02:15 PM
10-23-2009 02:15 PM
Re: help with this script requirement
In keeping with the Perl philosophy that "There Is More Than One Way To Do It" (TIMTOWTDI) I should add that you can use the output of 'diff' with the 'ed' command (as documented in the 'diff' manpages) _OR_ you can use the 'patch' utility, written by Larry Walls --- the creator of Perl itself.
Consider these two files:
# cat ./f1
#!/usr/bin/sh
[ "$#" = 0 ] && echo "arg required"
echo "you passed: '$@'"
exit 0
# cat ./f2
#!/usr/bin/sh
[ "$#" = 0 ] && { echo "arg required"; exit 1; }
echo "you passed: '$@'"
echo "nice work..."
exit 0
Now create a patch from the differences of the files:
# diff -e f1 f2 > mypatch
...add a "w"rite command for use with 'ed':
# echo w >> mypatch
# cp f1 f1.old
# ed f1 < mypatch
The 'f1' file is now identical to 'f2'.
Another way is to use 'patch'. Begin again using the original 'f1' and 'f2' files in this example:
# diff -e f1 f2 > mypatch #...as before...
# UNIX95= patch -e -i mypatch -o f1.new f1
Now you have a modified copy of 'f1' as 'f1.new' which matches 'f2'. Notice that no "w" character was appended to the 'mypatch' file created by 'diff' when the objective was to use 'patch'.
Notice too, that we set UNIX95 (XPG4) behavior to use the '-i' option of 'patch'. There is whitespace after the "UNIX95=" and before the "patch" command. There is no semicolon! This keeps UNIX95 set only for the duration of the command line. To do otherwise may lead to behavior your don't expect.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2009 02:49 PM
10-23-2009 02:49 PM
Re: help with this script requirement
Oops, the author of 'patch' and the author or Perl was Larry Wall. It is Larry Wall's work of which I spoke :-) Never change a sentence in mid-stream without really, really proof-reading.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2009 12:52 AM
10-26-2009 12:52 AM
Re: help with this script requirement
why not use the rcs feature between version?
HTH,
Art