![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Deleting lines in text file | hern14 | UNIX for Dummies Questions & Answers | 5 | 05-16-2008 12:03 PM |
| Deleting lines in a file | reachsamir | Shell Programming and Scripting | 2 | 05-29-2007 08:17 AM |
| Deleting last 2 lines from the file. | videsh77 | Shell Programming and Scripting | 4 | 04-06-2007 10:14 AM |
| Deleting Lines from .csv file | 009satya | Shell Programming and Scripting | 3 | 11-13-2006 11:41 PM |
| deleting lines in a log file | BG_JrAdmin | Shell Programming and Scripting | 2 | 08-22-2006 08:12 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
How I can delete 100 lines anywhere in a file without opening a file and without renaming the file.
|
| Forum Sponsor | ||
|
|
|
|||
|
Actually I have 8GB file which contains 200,000 records and I want to delete first 50,000 records without opening the file. At the same time I don't want to create another file once I delete the records because of space problem on server.
Is there any way I can delete 50,000 lines from 'abc.dat' and redirect output in the 'abc.dat' only. |
|
||||
|
Records are potentially very different from lines. You could have your own delimiters and have a record spanning several lines. If each line is a single record, then you could still run the following command under ksh:
Code:
sed -n "50000,200000p" file_to_cut_lines_from | cat > file_to_cut_lines_from |