- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script help
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-27-2003 07:00 AM
03-27-2003 07:00 AM
Script help
In a file, I want add a string "CC" 2 lines before a know string "C".
Ex.:
My original file is :
A
B
??? --> unknown string
C
D
The result would be :
A
B
CC
???
C
D
How I do this with awk.
Thanks in advance.
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 07:06 AM
03-27-2003 07:06 AM
Re: Script help
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x982ab941255cd71190080090279cd0f9,00.html
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 07:26 AM
03-27-2003 07:26 AM
Re: Script help
Well, this case is the cousin of your other thread. This will work:
#!/usr/bin/sh
sed '/^B/{
n
iCC
}' filename
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 07:30 AM
03-27-2003 07:30 AM
Re: Script help
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 07:54 AM
03-27-2003 07:54 AM
Re: Script help
A
B
C
C
A
C
turn in to?
A
CC
B
CC
C
C
CC
A
C
?
if there is no such conflicts possible,
l1:/tmp 106 > cat xx
A
B
??? --> unknown string
C
D
l1:/tmp 107 > perl -ne'@p>1&&print shift@p;/C/&&print"CC\n";push@p,$_}END{print@p' xx
A
B
CC
??? --> unknown string
C
D
l1:/tmp 108 >
Enjoy, have FUN! H.Merijn