- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: removing text from a ascii file
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-29-2001 01:43 PM
03-29-2001 01:43 PM
removing text from a ascii file
For instance the header data is the first 10 lines. I want to delete the first ten lines and mail the rest of the file.
Is there a command that will remove the first ten lines, or a command that will cut out all the lines of a file except the first ten lines so I can redirect it to another file. The log file can have any amount of lines at any time.
This will be done in batch mode, from a shell script.
The file is an ascii text file.
Any help would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2001 01:47 PM
03-29-2001 01:47 PM
Re: removing text from a ascii file
Try tail +10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2001 01:53 PM
03-29-2001 01:53 PM
Re: removing text from a ascii file
cat
This will read your file...delete lines 1 thru 10 and output to the newfile
/rcw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2001 10:20 PM
03-29-2001 10:20 PM
Re: removing text from a ascii file
tail +10 infile > outfile
sed 1,10d < infile > outfile
Hope this helps
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2001 10:22 PM
03-29-2001 10:22 PM
Re: removing text from a ascii file
If you prefere awk try this:
awk ' NR > 10 { print $0 } ' filename
NR is linenumber.
awk offers a lot more optins on changing text files. see man awk !
Klaus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2001 01:57 AM
03-30-2001 01:57 AM
Re: removing text from a ascii file
:1,10d
:wq!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2001 03:32 AM
03-30-2001 03:32 AM
Re: removing text from a ascii file
probably the most elegant solution is the first reply.
But the + flag is obsolete by now, so that you better go with the sed or awk solutions.
The only suggestion I have is to mail it in one go:
awk 'NR>10' /file/to/chop | mailx -s 'file chopped by 10 lines' you@your.account
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2001 03:43 AM
03-30-2001 03:43 AM
Re: removing text from a ascii file
You can even do it shorter:
sed 1,10d
Best regards,
Fred.