Sponsored Content
Top Forums Shell Programming and Scripting how to delete the line by line number Post 302513203 by jim mcnamara on Tuesday 12th of April 2011 02:49:15 PM
Old 04-12-2011
Code:
lin=14
sed "${lin}d"  inputfilename > newfilename

This deletes line #14
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

delete records using line number(NR)

Hai I have a flat file which contains more than 6 crore lines or records. I want to delete only one line, using line number. For example I want to delete 414556 th line . How to do this using sed or awk command. thanks (3 Replies)
Discussion started by: tkbharani
3 Replies

2. UNIX for Dummies Questions & Answers

delete multiple lines by line number

I have been googling, but cannot find that works for me. I have a text file tmp.out with contents: sadfsdf sdfosuidhfousdhof soduhf osdfu osudfhosudhfd sdfgsdfg asdfiojhsdf asdoludhflsdjfhskldjfhsdjdlfsjdhnlj h sdja ouahsdjdafkljsa oljhljh I have another file... (11 Replies)
Discussion started by: ChicagoBlues
11 Replies

3. UNIX for Dummies Questions & Answers

Using awk to get a line number to delete, piping through sed

Alright, I'm sure there's a more efficient way to do this... I'm not an expert by any means. What I'm trying to do is search a file for lines that match the two input words (first name, last name) in order to remove that line. The removal part is what I'm struggling with. Here is my code: echo... (4 Replies)
Discussion started by: lazypeterson
4 Replies

4. Shell Programming and Scripting

How would i delete a line at specific line number

Hi guys , I m writing a script to delete a line at particular location. But i m unable to use variable for specifying line number. for example. sed -n '7!p' filename works fine and deletes 7th line from my file but sed -n '$variable!p' filename gives following error. sed: -e... (12 Replies)
Discussion started by: pinga123
12 Replies

5. Shell Programming and Scripting

delete multiple lines by line number

I have file with 10000 records and i need to delete the lines in single shot based on line number range say from 10 to 51 , 53 to 59 , 105 to 107, 311 to 592 etc... between range works fine for me but how to achive for above case? please help sed '10,51 {d}' infile > outfile (5 Replies)
Discussion started by: zooby
5 Replies

6. Shell Programming and Scripting

Delete lines based on line number

I have a file with ~200K lines, I need to delete 4K lines in it. There is no range. I do have the line numbers of the lines which I want to be deleted. I did tried using > cat del.lines sed '510d;12d;219d;......;3999d' file > source del.lines Word too long. I even tried... (2 Replies)
Discussion started by: novice_man
2 Replies

7. Shell Programming and Scripting

How to delete several lines from file by line number?

Hi I am using the following command to delete a line from the file by line number: line_number=14 sed "${line_number}d" inputfilename > newfilename Is there a way to modify this command to specify the range of lines to be deleted, lets say from line 14 till line 5 ? I tried using the... (5 Replies)
Discussion started by: aoussenko
5 Replies

8. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

9. Shell Programming and Scripting

How to delete line number 3,6,9,12,15 and so on?

Hello, How can I remove line number 3,6,9,12,15,18 and so on for a text file using sed? The line number pattern is multiple 3. Thanks in advance. (6 Replies)
Discussion started by: huiyee1
6 Replies

10. Shell Programming and Scripting

Delete a specific line containing non consecutive number?

Dear Specialists, I have following data 1 1 2 2 2 3 3 3 6 4 3 4 5 4 9 6 5 11 7 6 7 and I would like to obtain data like below 1 1 2 2 2 3 4 3 4 7 6 7 (2 Replies)
Discussion started by: Ryan Kim
2 Replies
pgmnorm(1)						      General Commands Manual							pgmnorm(1)

NAME
pgmnorm - normalize the contrast in a portable graymap SYNOPSIS
pgmnorm [-bpercent N | -bvalue N] [-wpercent N | -wvalue N] [pgmfile] DESCRIPTION
Reads a portable graymap as input. Normalizes the contrast by forcing the lightest pixels to white, the darkest pixels to black, and lin- early rescaling the ones in between; and produces a portable graymap as output. OPTIONS
By default, the darkest 2 percent of all pixels are mapped to black, and the lightest 1 percent are mapped to white. You can override these percentages by using the -bpercent and -wpercent flags, or you can specify the exact pixel values to be mapped by using the -bvalue and -wvalue flags. Appropriate numbers for the flags can be gotten from the pgmhist tool. If you just want to enhance the contrast, then choose values at elbows in the histogram; e.g. if value 29 represents 3% of the image but value 30 represents 20%, choose 30 for bvalue. If you want to lighten the image, then set bvalue to 0 and just fiddle with wvalue; similarly, to darken the image, set wvalue to maxval and play with bvalue. All flags can be abbreviated to their shortest unique prefix. SEE ALSO
pgmhist(1), ppmnorm(1), pgm(5) AUTHOR
Partially based on the fbnorm filter in Michael Mauldin's "Fuzzy Pixmap" package. Copyright (C) 1989 by Jef Poskanzer. 28 February 1989 pgmnorm(1)
All times are GMT -4. The time now is 07:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy