Sponsored Content
Top Forums Shell Programming and Scripting Deleting all lines containing numbers Post 302749141 by dunryc on Thursday 27th of December 2012 03:36:10 PM
Old 12-27-2012
Deleting all lines containing numbers

Hi guys

I have a text file in the following format

Quote:
1410054
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec diam dui,
congue sed tristique eget, pulvinar in enim. Nam tortor odio, rhoncus
sit amet suscipit eget, fringilla non purus. Donec non condimentum neque.
Praesent adipiscing nibh at mauris aliquam non fermentum dolor adipiscing.
Ut dolor mauris, condimentum in dapibus non, convallis vitae quam. Aenean
tincidunt justo at magna congue condimentum. Vestibulum lacus nisl, portt

1410187
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec diam dui,
congue sed tristique eget, pulvinar in enim. Nam tortor odio, rhoncus
sit amet suscipit eget, fringilla non purus. Donec non condimentum neque.
Praesent adipiscing nibh at mauris aliquam non fermentum dolor adipiscing.
Ut dolor mauris, condimentum in dapibus non, convallis vitae quam. Aenean
tincidunt justo at magna congue condimentum. Vestibulum lacus nisl, portt
what i would like ot do is iterate through the file deleting the lines containing only numbers. I have googled this and have been unable to find any help ( maybe its my search terms)

so if any one an give me a heads up i would appreciate it

dunryc
 

10 More Discussions You Might Find Interesting

1. Programming

deleting lines

I am spooling a file from oracle and trying to delete the last line of the spooled file which I am unable to do. Problem is that this file can have multiple records each time and I have no way of knowing how many because the amount can vary. I had an idea of using a while loop to read the... (1 Reply)
Discussion started by: supercbw
1 Replies

2. 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

3. Shell Programming and Scripting

Deleting lines above a certain line

Hi, I have a file that gets automatically generated and it would look something like sakjsd adssad {{word}} sddsasd dsdsasa . . . So basically what I want to do is just keep the stuff below the {{word}} marker. The marker includes the brackets. Is there any command to delete the... (3 Replies)
Discussion started by: eltinator
3 Replies

4. Shell Programming and Scripting

Deleting the similar lines

Dear Friends myself Avinash working in bash shell The problem goes like this I have a file called work.txt assume that first colum=mac address second colum= IP third colum = port number ---------------------------------------- 00:12:23:34 192.168.50.1 2 00:12:23:35 192.168.50.1 5... (2 Replies)
Discussion started by: avi.skynet
2 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 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

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 lines not starting with numbers with sed

Title says all :p Thanks for your help (4 Replies)
Discussion started by: drbiloukos
4 Replies

9. UNIX for Dummies Questions & Answers

Help with deleting lines and saving them

I have a directory question where I ask the user which entry he wants to delete... echo "Which entry?" read entry sed '/^'$entry'/d' file This code does in fact delete that particular entry... HOWEVER, when I go to inquire about that same entry, it still populates like it was never... (4 Replies)
Discussion started by: itech4814
4 Replies

10. Shell Programming and Scripting

Deleting all lines except last 500

Hi All, I want to write a script which first check the line counts of a file if its more than 500 it deletes rest except the last 500.. I tried sed but it looks sed counts line numbers from the head & not from tail.. May be I need a wc -l frist then apply if statement & pass on the line count... (17 Replies)
Discussion started by: ailnilanjan
17 Replies
Text::Wrap(3pm) 					User Contributed Perl Documentation					   Text::Wrap(3pm)

NAME
GD::Text::Wrap - Wrap strings in boxes SYNOPSIS
use GD; use GD::Text::Wrap; my $gd = GD::Image->new(800,600); # allocate colours, do other things. my $text = <<EOSTR; Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. EOSTR my $wrapbox = GDTextWrap->new( $gd, line_space => 4, color => $black, text => $text, ); $wrapbox->set_font(gdMediumBoldFont); $wrapbox->set_font('arial', 12); $wrapbox->set(align => 'left', width => 120); $wrapbox->draw(10,140); $gd->rectangle($wrap_box->get_bounds(10,140), $color); DESCRIPTION
GD::Text::Wrap provides an object that draws a formatted paragraph of text in a box on a GD::Image canvas, using either a builtin GD font or a TrueType font. METHODS
This class doesn't inherit from GD::Text directly, but delegates most of its work to it (in fact to a GD::Text::Align object. That means that most of the GD::Text::Align methods are available for this class, specifically "set_font" and "font_path". Other methods and methods with a different interface are described here: GD::Text::Wrap->new( $gd_object, attribute => value, ... ) Create a new object. The first argument to new has to be a valid GD::Image object. The other arguments will be passed to the set() method for initialisation of the attributes. $wrapbox->set( attribute => value, ... ) set the value for an attribute. Valid attributes are: width The width of the box to draw the text in. If unspecified, they will default to the width of the GD::Image object. line_space The number of pixels between lines. Defaults to 2. para_space, paragraph_space The number of extra pixels between paragraphs, above line_space. Defaults to 0. color, colour Synonyms. The colour to use when drawing the font. Will be initialised to the last colour in the GD object's palette. align, alignment Synonyms. One of 'justified' (the default), 'left', 'right' or 'center'. text The text to draw. This is the only attribute that you absolutely have to set. preserve_nl If set to a true value, newlines in the text will cause a line break. Note that lines will still be justified. If only one word appears on the line, it could get ugly. Defaults to 0. As with the methods, attributes unknown to this class get delegated to the GD::Text::Align class. $wrapbox->get( attribute ); Get the current value of an attribute. All attributes mentioned under the "set()" method can be retrieved $wrapbox->get_bounds() Returns the bounding box of the box that will be drawn with the current attribute settings as a list. The values returned are the coordinates of the upper left and lower right corner. ($left, $top, $right, $bottom) = $wrapbox->get_bounds(); Returns an empty list on error. NOTE: The return list of this method may change in a future implementation that allows angled boxes. $wrapbox->draw(x, y) Draw the box, with (x,y) as the top right corner. Returns the same values as the "getbounds()" method. NOTE: The return list of this method may change in a future implementation that allows angled boxes. NOTES
As with all Modules for Perl: Please stick to using the interface. If you try to fiddle too much with knowledge of the internals of this module, you may get burned. I may change them at any time. You can only use TrueType fonts with version of GD > 1.20, and then only if compiled with support for this. If you attempt to do it anyway, you will get errors. Even though this module lives in the GD::Text namespace, it is not a GD::Text. It does however delegate a lot of its functionality to a contained object that is one (GD::Text::Align). BUGS
None that I know of, but that doesn't mean much. There may be some problems with exotic fonts, or locales and character encodings that I am not used to. TODO
Angled boxes. At the moment, the only bit of the box that is allowed to be unspecified and in fact must be unspecified, is the bottom. If there is enough need for it, I might implement more flexibility, in that that you need to only specify three of the four sides of the box, and the fourth will be calculated. Automatic resizing of a TrueType font to fit inside a box when four sides are specified, or maybe some other nifty things. More flexibility in the interface. Especially draw needs some thought. More and better error handling. Warnings for lines that are too long and stick out of the box. Warning for emptyish lines? COPYRIGHT
copyright 1999 Martien Verbruggen (mgjv@comdyn.com.au) SEE ALSO
GD, GD::Text, GD::Text::Align perl v5.12.3 2003-02-24 Text::Wrap(3pm)
All times are GMT -4. The time now is 04:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy