- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- any way to cat a file from 3rd line....
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
10-24-2007 12:31 AM
10-24-2007 12:31 AM
Is there any way that i can cat a file and see the contents fro 3 line onwards.....leaving head and tail.........
i.e. if i have a file containing 10 lines........i should be able to view the file using cat command ,but from 3rd line ....onwards..........
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 12:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 12:42 AM
10-24-2007 12:42 AM
Re: any way to cat a file from 3rd line....
perl -n 'print if $. > 2' file
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 12:46 AM
10-24-2007 12:46 AM
Re: any way to cat a file from 3rd line....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 12:50 AM
10-24-2007 12:50 AM
Re: any way to cat a file from 3rd line....
cat file | awk 'NR > 2'
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 12:55 AM
10-24-2007 12:55 AM
Re: any way to cat a file from 3rd line....
I like the 'awk' solution but not with the additional 'cat' process!
# awk 'NR > 2' file
Let 'awk' open the file itself rather than having both 'cat' and 'awk' do I/O.
As you can see, your solution exists easily in 'sed', 'awk' or 'perl'. From a resource standpoint, I suspect that 'sed' is probably the fastest with the smallest memory footprint for this task.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 02:32 AM
10-24-2007 02:32 AM
Re: any way to cat a file from 3rd line....
tail -n +3 file
?
HP-Server-Literate since 1979
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 02:41 AM
10-24-2007 02:41 AM
Re: any way to cat a file from 3rd line....
>Mike: I like everyone's awk, sed and perl solutions, but I'm wondering - what's wrong with a simple tail -n +3 file
Nothing. In the words of Perl: TMTOWTDI
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 02:49 AM
10-24-2007 02:49 AM
Re: any way to cat a file from 3rd line....
>Nothing. In the words of Perl: TMTOWTDI
:) :) :)
Seriously, I didn't know if tail was just too much of a Resource Hog to consider.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2007 05:19 AM
10-24-2007 05:19 AM
Re: any way to cat a file from 3rd line....
# ex -s +'3,$p|q!' file