- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Extract a paragraph using sed
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
06-03-2003 06:59 PM
06-03-2003 06:59 PM
Does any have some good tips to share for extracting any tagged
lines...
lines...
lines...
lines...
lines...
lines...
lines...
lines...
lines...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 12:06 AM
06-04-2003 12:06 AM
Re: Extract a paragraph using sed
I don't really think that sed is the best tool to do this and also I'm not really sure to understand what output you need. But this script should display
Regards.
input file is :
a1
a2
a3
QWERTYUIOP
dummy lines ...
b1
b2
b3
Sed command would be :
sed -n '/
p
n
p
n
p
n
p
}' file
Output would b :
a1
a2
a3
b1
b2
b3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 12:30 AM
06-04-2003 12:30 AM
Re: Extract a paragraph using sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 12:36 AM
06-04-2003 12:36 AM
Re: Extract a paragraph using sed
try this
awk '{ line[NR]=$0 }
END {
number=10
for (i=0 ; i <=NR ; i++) {
if ( line[i] ~ /
for (ii=i ; ii <=i+number ; ii++) {
print line[ii]
}
}
}
}
' inputfile
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 01:13 AM
06-04-2003 01:13 AM
Re: Extract a paragraph using sed
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf6ca0bce6f33d6118fff0090279cd0f9,00.html
Good luck,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 02:18 AM