- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: sed substitution using reg exp commands not wo...
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
Discussions
Discussions
Forums
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
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
тАО04-15-2010 06:45 AM
тАО04-15-2010 06:45 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
It certainely doesn't mean your suggestion didn't work. the whole point of 2) was , when stripping off the abs paths from the script, the code shouldn't touch the header (like #!/usr/bin/ksh). I was using something complex like grepping the header into a variable and then deletign it only to be inserted again at the top from the variable content. But in HP-UX was facing problem doing the same.
But found a workaround, simple one liner, where we can make the sed to ignore a particular line when substituting.
like,
1!s/oldline/newline/g
so used it.
The answer about using GNU sed was for steven.
Sorry to confuse you.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 06:57 AM
тАО04-15-2010 06:57 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
I tried your change and below is the code executing in debug mode. It truncated the whole file with a single line in it. pls check the below update.
echo $DEST_DIR/$1 | sed -e '2i\
'"export PATH=\$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/" > $DEST_DIR/new_$1
+ sed -e 2i\
export PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/
+ echo /u08/iBS/release/new_scripts_sree/test_file.sh
+ 1> /u08/iBS/release/new_scripts_sree/new_test_file.sh
mv $DEST_DIR/new_$1 $DEST_DIR/$1
+ mv /u08/iBS/release/new_scripts_sree/new_test_file.sh /u08/iBS/release/new_scripts_sree/test_file.sh
$ cat test_file.sh
/u08/iBS/release/new_scripts_sree/test_file.sh
$
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 07:07 AM
тАО04-15-2010 07:07 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
I made a small change to your code and it worked. :)
Thanks a lot.
the code i used,
sed -e '2i\
'"export PATH=\$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin/" $DEST_DIR/$1 > $DEST_DIR/new_$1
I appreciate all your help.
Best Regards & THanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 07:07 AM
тАО04-15-2010 07:07 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
>
> Sorry to confuse you.
It confused me, too.
My point was that if you want a "sed" on an
HP-UX system to work exactly like the (GNU)
"sed" on a GNU/Linux system, then it might
make some sense to use GNU "sed" on the HP-UX
system.
> Yes, I followed GNU sed.
I don't know what that means.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 07:13 AM
тАО04-15-2010 07:13 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
Now i understand exactly what you mean.
Thanks for clarifying. Yes. THat is a important point to note. Can you kindly let me know how to make sure that both Linux and HP-UX are using GNU sed?
When i said i am following GNU sed, what i meant was, that i followed the sed coding rules laid out by GNU. But not exactly...
Sorry if i am still driving you nuts. :)
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 07:13 AM
тАО04-15-2010 07:13 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
> I made a small change to your code and it worked. :)
> Thanks a lot.
> I appreciate all your help.
If you are happy with the answers you received, please read:
http://forums13.itrc.hp.com/service/forums/helptips.do?#28
Since you are new to the Forums, "welcome!".
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 07:18 AM
тАО04-15-2010 07:18 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
Will do it for sure.
You deserve it.
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 10:32 AM
тАО04-15-2010 10:32 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
> HP-UX are using GNU sed?
On a GNU/Linux system, I'd expect "sed" to be
GNU "sed".
sed --version
On HP-UX, you'd need to install GNU "sed".
After it's installed, you can run whichever
"sed" you wish to run by specifying an
appropriate path. For example
/usr/bin/sed
/usr/local/bin/sed
If you say only "sed", then what you get
depends on your PATH. Depending on your
shell:
which sed
type sed
echo $PATH
man
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2010 12:16 AM
тАО04-16-2010 12:16 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
Hello Steven
Many Thanks for your reply.
That will make my life easier going forward.
Will keep a note of this for future reference.
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2010 12:33 AM
тАО04-16-2010 12:33 AM
Re: sed substitution using reg exp commands not working on HP-UX. Need help.
Please refer to the updates for solution.
- « Previous
-
- 1
- 2
- Next »