Sponsored Content
Full Discussion: deleting lines by number
Top Forums UNIX for Dummies Questions & Answers deleting lines by number Post 47544 by Optimus_P on Thursday 12th of February 2004 09:31:14 AM
Old 02-12-2004
use perl.

read the file into an array and push undef into the line you want to delete.

to ditch the last 3 lines use the variable $#array_name (this is a numerical value of the total # of elements in the array) and use pop to get them off the stack.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

deleting lines

I am trying deleting lines from a text file using sed.. sed '/OBJECT="ABC/{N;N;N;d; }' will do if i have to delete lines starting with Object and next 3 lines but I was looking for a way to delet lines starting with OBJECT and all the lines till it reaches a blank lines ..or it reaches a... (8 Replies)
Discussion started by: ajnabi
8 Replies

2. Shell Programming and Scripting

Deleting particular lines.

hi all, i have got a scenario in which i need to delete all the lines that ends with file names. e.g. input can be cms/images/services_icons/callback.png cms/cms/images/services_icons/sync.php cms/cms/images/services_icons and output should be cms/cms/images/services_icons ... (13 Replies)
Discussion started by: kashifv
13 Replies

3. Shell Programming and Scripting

Number lines of file and assign variable to each number

I have a file with a list of config files numbered on the lefthand side 1-300. I need to have bash read each lines number and assign it to a variable so it can be chosen by the user called by the script later. Ex. 1 some data 2 something else 3 more stuff which number do you... (1 Reply)
Discussion started by: glev2005
1 Replies

4. Shell Programming and Scripting

count the number of lines that start with the number

I have a file with contents similar to this. abcd 1234 4567 7666 jdjdjd 89289 9382 92 jksdj 9823 298 I want to write a shell script which count the number of lines that start with the number (disregard the lines starting with alphabets) (1 Reply)
Discussion started by: grajp002
1 Replies

5. UNIX for Dummies Questions & Answers

deleting a row if a certain column is below a certain number

How can you delete a row if a certain column is bigger than a certain number? I have the following input: 20080709 20081222 95750 1 0 0.02 94.88 20080709 20081222 95750 2 0 0.89 94.88 20080709 20081222 9575 1 0 0 94.88 20080709 20081222 9575 2 0 0 94.88 20080709 20081222 9587.5 1 0 0... (1 Reply)
Discussion started by: Pep Puigvert
1 Replies

6. UNIX for Dummies Questions & Answers

deleting a row if a certain column is below a certain number

How can you delete a row if a certain column is bigger than a certain number? I have the following input: 20080709 20081222 95750 1 0 0.02 94.88 20080709 20081222 95750 2 0 0.89 94.88 20080709 20081222 9575 1 0 0 94.88 20080709 20081222 9575 2 0 0 94.88 20080709 20081222 9587.5 1 0 0... (6 Replies)
Discussion started by: Pep Puigvert
6 Replies

7. Shell Programming and Scripting

deleting lines in ex

Hello, im using ex to manipulate some text. Im trying to delete all the lines except those on which a certain regex can be found. the important part of the script: ex temp << 'HERE' g/regex/p HERE this command prints the lines I want to end up with, but it doesnt delete the others.... (2 Replies)
Discussion started by: drareeg
2 Replies

8. Shell Programming and Scripting

Deleting Line number from different file

file 1 abcde,dfgdfg,sdfds sdfsd,sdfd,sdfg,sdfs dwfds,sdfgdfg,sdfsdf file2 1 3 i need to delete the line numbers file 1 based on file2 i have taken in loop file 1 and i cant able to delete that line number in file 1 Plz help (4 Replies)
Discussion started by: ragu.selvaraj
4 Replies

9. Shell Programming and Scripting

Grep lines for number greater than given number

Hello, I am newbie to bash scripting. Could someone help me with the following. I have log file with output as shown below **************************LOG************************* 11/20/2013 9:11:23.64 Pinging xx.xx.xx.xx with 32 bytes of data: 11/20/2013 9:11:23.64 Reply from xx.xx.xx.xx:... (4 Replies)
Discussion started by: meena_2013
4 Replies

10. UNIX for Beginners Questions & Answers

Print number of lines for files in directory, also print number of unique lines

I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with: wc -l *|sort 15263 Image.txt 16401 reference.txt 40459 richtexteditor.txt How can I also print the number of unique lines in each file? 15263 1401 Image.txt 16401... (15 Replies)
Discussion started by: spacegoose
15 Replies
NDC(3pm)						User Contributed Perl Documentation						  NDC(3pm)

NAME
Log::Log4perl::NDC - Nested Diagnostic Context DESCRIPTION
Log::Log4perl allows loggers to maintain global thread-specific data, called the Nested Diagnostic Context (NDC). At some point, the application might decide to push a piece of data onto the NDC stack, which other parts of the application might want to reuse. For example, at the beginning of a web request in a server, the application might decide to push the IP address of the client onto the stack to provide it for other loggers down the road without having to pass the data from function to function. The Log::Log4perl::Layout::PatternLayout class even provides the handy %x placeholder which is replaced by the blank-separated list of elements currently on the stack. This module maintains a simple stack which you can push data on to, query what's on top, pop it off again or delete the entire stack. Its purpose is to provide a thread-specific context which all Log::Log4perl loggers can refer to without the application having to pass around the context data between its functions. Since in 5.8.0 perl's threads don't share data only upon request, global data is by definition thread-specific. Log::Log4perl::NDC->push($text); Push an item onto the stack. If the stack grows beyond the defined limit ($Log::Log4perl::NDC::MAX_SIZE), just the topmost element will be replated. This is typically done when a context is entered. Log::Log4perl::NDC->pop(); Discard the upmost element of the stack. This is typically done when a context is left. my $text = Log::Log4perl::NDC->get(); Retrieve the content of the stack as a string of blank-separated values without disrupting the stack structure. Typically done by %x. If the stack is empty the value "[undef]" is being returned. Log::Log4perl::NDC->remove(); Reset the stack, remove all items. Please note that all of the methods above are class methods, there's no instances of this class. COPYRIGHT AND LICENSE
Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-07-21 NDC(3pm)
All times are GMT -4. The time now is 04:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy