- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell script
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
тАО09-03-2002 08:52 AM
тАО09-03-2002 08:52 AM
Shell script
The input file (either fixed length or tab delimited) contains a header (i.e. first line) and footer (i.e. last line), and detail records. Each header contains constant value of '10' and each footer contains a constant value of '99'. The input file should be split into 2 files, one file with only header and footer, and the second file with only detail records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2002 09:00 AM
тАО09-03-2002 09:00 AM
Re: Shell script
Can you attach an example file ?
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2002 09:03 AM
тАО09-03-2002 09:03 AM
Re: Shell script
# sed -n -e /10/p -e /99/p file.in > file.hdr
# sed -e /10/d -e /99/d file.in > file.details
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2002 09:06 AM
тАО09-03-2002 09:06 AM
Re: Shell script
Grep version:
grep -v -e "10" -e "99" infile > outfile
grep -e "10" -e "99" infile > outfile
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2002 10:12 AM
тАО09-03-2002 10:12 AM
Re: Shell script
If you prefer a general script that snips the first and last lines from a file, regardless of content, use something like:
# sed -n -e '1p' -e '$p' file.in > file.hdr
# sed -e '1d' -e '$d' file.in > file.det
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2002 10:26 AM
тАО09-03-2002 10:26 AM
Re: Shell script
10 MSV024 20020822 175149
20 40392 Jones,Donald P 46916 7290 6545315 107 EDA
20 42409 Miller,Jacob S 32384 7290 6545315 107 KEA
20 44656 Davis,Rick 38608 1011 7950607 006 116
20 45908 Smith,Cary 40476 9505 9005165 011 616
99 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2002 10:38 AM
тАО09-03-2002 10:38 AM
Re: Shell script
Now that you have supplied the data, the above solutions can be made to work by putting a "^" in front of the "10" and one in front of the "99", since these numbers appear at the front of the line.
Was their something else that you wanted done to the data?
-- Rod Hills