- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sed question?
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
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
тАО05-12-2009 11:46 AM
тАО05-12-2009 11:46 AM
#ssh host1 sed '$d' /root/hosts > /etc/hosts
sed: -e expression #1, char 8: Extra characters after command
How to use sed thru ssh on a remote host?
Thanks,
Allan
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-12-2009 11:52 AM
тАО05-12-2009 11:52 AM
Re: sed question?
#ssh host1 "sed '$d' /root/hosts > /etc/hosts"
- Tags:
- quoting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-12-2009 11:55 AM
тАО05-12-2009 11:55 AM
Re: sed question?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-12-2009 11:59 AM
тАО05-12-2009 11:59 AM
Re: sed question?
# ssh -n host1 'sed "$d" /root/hosts > /etc/hosts'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-12-2009 12:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-12-2009 12:04 PM
тАО05-12-2009 12:04 PM
Re: sed question?
Please remember to evaulate the answers you received, here, too:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1335006
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-12-2009 12:07 PM
тАО05-12-2009 12:07 PM
Re: sed question?
Question - Can you explain a little bit why \$d is needed for remote hosts ?
Allan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-12-2009 12:14 PM
тАО05-12-2009 12:14 PM
Re: sed question?
> Question - Can you explain a little bit why \$d is needed for remote hosts ?
We escape the dollar-sign so that the shell doesn't attempt to evaluate $d as a variable, but rather leave that for 'sed' to interpret.
You can see this if you compare:
# sed "$d" /root/hosts
...and:
# sed "\$d" /root/hosts
...which is why if we wrote this to run locally, we could do:
# sed '$d' /root/hosts
...with the sinqle quotes so that the shell doesn't try to evaluate the $.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-12-2009 12:16 PM
тАО05-12-2009 12:16 PM