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
тАО11-08-2006 09:07 AM
тАО11-08-2006 09:07 AM
AWK/SED
1)Replace a particular filename by the contents of the file in a master file
Tried it with sed but sed cudnt know how to replace the file contents something like
XYZ=srch pattern
ABC=FILE.
XYZ could be anywhere of course :)
sed 's/XYZ/`cat ABC`/g'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2006 09:18 AM
тАО11-08-2006 09:18 AM
Re: AWK/SED
you where on the right path!
The first change for a solution would be to substitue the singlequotes to double quotes:
1) sed "s/XYZ/`cat ABC`/g"
BUT: you have to keep in mind, that
a character "/" in the file content of 'ABC' will make the substitute pattern invalid because "/" is the pattern delimiter. You can use any character NOT in file ABC for this purpose, e.g.
2) sed "s├В┬зXYZ├В┬з`cat ABC`├В┬зg"
There is no need for spawning an extra 'cat' process in posix shells, use
3) sed "s/XYZ/$(
Take extra care when ABC contains newlines.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2006 09:42 AM
тАО11-08-2006 09:42 AM
Re: AWK/SED
# ex -s +"/XYZ/r ABC | /XYZ/d | x" file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2006 09:47 AM
тАО11-08-2006 09:47 AM
Re: AWK/SED
# perl -pe 'if (s/XYZ//) {chomp;open(FH,"<","XYZ") or die;@a=
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2006 09:01 PM
тАО11-08-2006 09:01 PM
Re: AWK/SED
export FILE=/path/nameofyourfile
sed "s!XYZ!$(<$FILE)!g"
When using " " quotes you can
embedd variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-16-2007 11:42 PM
тАО01-16-2007 11:42 PM
Re: AWK/SED
Every response to your question is eligible to earn between 1-10 points. No need to worry about running out of points - when a truly awesome reply rolls in that deserves a 10, you will be able to assign it a 10! However, be careful to assign points based on the value that a reply truly provides. Use the following scale as a guideline:
o N/A: The answer was simply a point of clarification to my original question
o 1-3: The answer didn't really help answer my question, but thanks for your assistance!
o 4- 7: The answer helped with a portion of my question, but I still need some additional help!
o 8-10: The answer has solved my problem completely! Now I'm a happy camper!
Although assigning points is not mandatory, it is a key component of a strong, interactive community, and it is STRONGLY ENCOURAGED. Others have taken time to help you, so please take a moment to give them credit for their assistance!