Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deleting whole lines from a file Post 302212487 by Franklin52 on Monday 7th of July 2008 05:54:57 PM
Old 07-07-2008
Quote:
Originally Posted by red baron
So I just want to make sure I follow this. You converted the numbering of lines to base 44 (that's what the NR % 44 was, I gather) so that you could delete any line with a ones place of 9 or under? What's the 0 {next} 1 bit, if you don't mind my asking?
Also, thanks very much for your help!
Code:
awk 'NR%44 < 10 && NR % 44 > 0{next} 1' file > newfile

The awk variable NR gives the line number, the modulo operator % gives the remainder of the division of NR by 44.

Code:
NR%44 < 10 && NR % 44 > 0{next}

Skip lines if the remainder is less then 10 and greater then 0, thus the lines 1-9, 45-53, 89-97, etc. are not printed.

The 1 means true to awk and invokes awk to print the line.


Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

deleting lines in a log file

Is there an easy way to delete the first so many lines in a log file? like I have a log file that has 10000 lines, i want to just get rid of the first 9000. (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

2. Shell Programming and Scripting

Deleting last 2 lines from the file.

Hi I have a file & always I need to remove or delete last 2 lines from that file. So in a file if I have 10 lines then it should return me first 8 lines. Can someone help me? (4 Replies)
Discussion started by: videsh77
4 Replies

3. Shell Programming and Scripting

Deleting lines in a file

How do I delete all the lines after the line containing text ***DISCLOSURES*** . I want to delete this line too. Thank you (2 Replies)
Discussion started by: reachsamir
2 Replies

4. Shell Programming and Scripting

Deleting lines ending with . from a file

HI I'm looking to delete lines ending with .tk from below data file --------- abc.tk mgm.tk dtk mgmstk ------ I have written below code ---- sed '/.tk *$/d' dat_file.txt > temp.txt ---- But its deleting all the lines ending with tk. I need to delete only the lines ending .tk my... (5 Replies)
Discussion started by: shekhar_v4
5 Replies

5. UNIX for Advanced & Expert Users

Deleting lines from a file

How I can delete 100 lines anywhere in a file without opening a file and without renaming the file. (11 Replies)
Discussion started by: Nirgude07
11 Replies

6. Shell Programming and Scripting

deleting lines from file

We have a server that logs transactions to a file. I want to write a script that will delete the first 50 lines of the file daily without renameing the file or moving the file. (8 Replies)
Discussion started by: daveisme
8 Replies

7. Shell Programming and Scripting

Deleting certain new lines from a file with shell

Good morning!!! Im a newbie with shell programing and i was wondering if there is a way to delete certain new lines from a file, here is an example of my current file: >seq_0 GTGAGATTGCTAATGAGCTGCTTTTAGGGGGCGTGTTGTGCTTGCTTTCC AACTTTTCTAGATTGATTCTACGCTGCCTCCAGCAGCCACCCCTCCCATC... (11 Replies)
Discussion started by: machalita
11 Replies

8. Shell Programming and Scripting

Re: Deleting lines from big file.

Hi, I have a big (2.7 GB) text file. Each lines has '|' saperator to saperate each columns. I want to delete those lines which has text like '|0|0|0|0|0' I tried: sed '/|0|0|0|0|0/d' test.txt Unfortunately, it scans the file but does nothing. file content sample:... (4 Replies)
Discussion started by: dipeshvshah
4 Replies

9. Shell Programming and Scripting

Deleting specific lines in a file

Hello, I have a file filled with dates, such as: 04-08-2011 message 04-08-2011 message 03-08-2011 message 01-08-2011 message 31-07-2011 message 24-07-2011 message 15-07-2011 message 13-12-2008 message 26-11-2007 message And I want to delete those lines whose date is older than 10... (5 Replies)
Discussion started by: asanchez
5 Replies

10. Shell Programming and Scripting

Deleting selected lines in a file

Hi Guys , I have two files say a1 and a2 having following contents a1 dag wfd a2 dag wfd chire hcm I want to delete only the lines in a2 which are in a1 and final output of a2 should be a2 chire hcm (6 Replies)
Discussion started by: Pradeep_1990
6 Replies
GLDEPTHRANGE(3G)														  GLDEPTHRANGE(3G)

NAME
glDepthRange - specify mapping of depth values from normalized device coordinates to window coordinates C SPECIFICATION
void glDepthRange( GLclampd near_val, GLclampd far_val ) PARAMETERS
near_val Specifies the mapping of the near clipping plane to window coordinates. The initial value is 0. far_val Specifies the mapping of the far clipping plane to window coordinates. The initial value is 1. DESCRIPTION
After clipping and division by w, depth coordinates range from -1 to 1, corresponding to the near and far clipping planes. glDepthRange specifies a linear mapping of the normalized depth coordinates in this range to window depth coordinates. Regardless of the actual depth buffer implementation, window coordinate depth values are treated as though they range from 0 through 1 (like color components). Thus, the values accepted by glDepthRange are both clamped to this range before they are accepted. The setting of (0,1) maps the near plane to 0 and the far plane to 1. With this mapping, the depth buffer range is fully utilized. NOTES
It is not necessary that near_val be less than far_val. Reverse mappings such as near_val=1, and far_val=0 are acceptable. ERRORS
GL_INVALID_OPERATION is generated if glDepthRange is executed between the execution of glBegin and the corresponding execution of glEnd. ASSOCIATED GETS
glGet with argument GL_DEPTH_RANGE SEE ALSO
glDepthFunc(3G), glPolygonOffset(3G), glViewport(3G) GLDEPTHRANGE(3G)
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy