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-16-2003 06:58 AM
06-16-2003 06:58 AM
.
Sorry to trouble you with what's probably a simple problem.
.
I have a large text file with information on FC10, Nike and AutoRAID arrays. I'm trying to pull informatin on these arrays and put the info in another file for manipulation. Problems is, I can't remember how to pull the next 100 lines from the original file and move them to the second file.
.
I currently am using cat to read the original file, then grep to find the line with the header information, and there I'm lost.
.
Any help would be greatly appreciated.
.
Paul Middleton
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 07:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 07:10 AM
06-16-2003 07:10 AM
Re: How Do I
Here's one way. Assume that you want to begin extracting 100 lines from file where the string named 'token' first appears:
# awk '/token/ {print;for (i==0;i<5;i++) {getline;print}}' inputfile > outputfile
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 07:10 AM
06-16-2003 07:10 AM
Re: How Do I
$ sed -n '15,50p' the-file
To append these to another file, simply redirect the output with >>.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 07:11 AM
06-16-2003 07:11 AM
Re: How Do I
/corrected for 100-lines/
Here's one way. Assume that you want to begin extracting 100 lines from file where the string named 'token' first appears:
# awk '/token/ {print;for (i==0;i<100;i++) {getline;print}}' inputfile > outputfile
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 07:11 AM
06-16-2003 07:11 AM
Re: How Do I
.
Problem is that the infomation can be anywhere in the file. What I need is a way to find the matching line in the text file, copy it and/or the next hundred lines to another file, and resume with my searching.
.
Regards,
Paul Middleton
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 07:12 AM
06-16-2003 07:12 AM
Re: How Do I
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 07:15 AM
06-16-2003 07:15 AM
Re: How Do I
if you want to split the file in chunks of 100 lines, then you only have to use split:
split -l 100
will create files named
If you want to have the last 100 lines:
tail -n 100
If you want to have the 100 lines ending at line X:
head -n X
You can combine all these commamds with a "grep" command, of course:
grep "header"
works...
Cheers,
FiX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:31 AM
06-16-2003 09:31 AM
Re: How Do I
S.K.Chan - Good idea, it will be usefull in the future.
Chris Vail - VI, are you nuts? I want to finish this project this year ! Remember the saying, Unix is a four-letter word and vi is the abbreviation.
F.X. de Montfolfier - Good ideas, they will help me down th line.
.
James R. Ferguson - Exactly what I needed. I was part way there, but the spaces were driving me nuts. (short drive, I could probably walk.)
.
Thanks to all for your help. The forums are as good as bouncing questions off the other C.E.'s when I was with HP in Cleveland.
.
Regards,
Paul Middleton