- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Replacing text with multiple lines
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
03-14-2001 01:46 PM
03-14-2001 01:46 PM
I have a text config file.
I want to replace any instance of the word SET with
"SET
TROUBLETICKET".
I tried sed and awk but they get confused with the carriage return between set and troubleticket which is required. Any ideas? I need to make this an automatic process because there is going to be around 800 hundred instances of SET in this file and we need to do this translation about once a month. Any help would be appreciated (along with ten points). Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2001 02:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2001 02:31 PM
03-14-2001 02:31 PM
Re: Replacing text with multiple lines
SET
TROUBLETICKET
any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2001 02:34 PM
03-14-2001 02:34 PM
Re: Replacing text with multiple lines
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2001 02:39 PM
03-14-2001 02:39 PM
Re: Replacing text with multiple lines
*******************************start script
#!/bin/sh
inputfile="/tmp/pww/file"
outputfile="/tmp/pww/file1"
outputfile1="/tmp/pww/file2"
cat $inputfile | awk '{ gsub(/SET/,"SET TROUBLE TICKET" ); print }' > $outputfile
cat $outputfile | awk '
{
if ( $1 != "SET" )
{ print $0 }
else
{ split($0,word," "); print word[1];print word[2],word[3] }
}' > $outputfile1
******************************end script
you could even do something at the end of the script to move the the output file to the inputfile name.
I hope the script makes sense. It is also attached to this reply.