Sponsored Content
Top Forums Shell Programming and Scripting Egrep or awk for removing values within CSV file? Post 302936601 by macurdy on Thursday 26th of February 2015 02:43:01 PM
Old 02-26-2015
Thank you for the help. With the suggestion, I was able to get the text formatted correctly.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to compare two csv files values and write into another csv file

Hi all, Am new to scripting. So i just need your ideas to help me out. Here goes my requirement. I have two csv files 1.csv 2.csv abc,1.24 abc,1 def,2.13 def,1 I need to compare the first column of 1.csv with 2.csv and if matches then need to compare... (2 Replies)
Discussion started by: chinnahyd
2 Replies

2. UNIX for Dummies Questions & Answers

Help removing strings from one file that match any of the values in a second file.

Hello, I have a file that lists a few hundred values. Example: abca abcb abcc abcd I have a 2nd file with a few thousand lines. I need to remove every line from the 2nd file that contains any of the values listed in first file. Example of strings to delete: line1 *abca* end of... (1 Reply)
Discussion started by: upstate_boy
1 Replies

3. Shell Programming and Scripting

How to grep/awk/egrep two values for given output?

Dear Friends, I have a command which can result following output. Packet is: /var/adm/yyyy/pkt6043 Intended for network : /vob/repo I would like to retrive pkt6043 and /vob/repo using single command. Blue color test will be always contstant and red color text will be dynamic ... (2 Replies)
Discussion started by: baluchen
2 Replies

4. Linux

Removing non printing characters from a csv file

Hi, I have an csv file and there are some non printable characters(extended ascii) so I am trying to create a clean copy of the csv file . I am using this command: tr -cd "" < /opt/informatica/PowerCenter8.6.0/server/infa_shared/SrcFiles/ThirdParty/locations.csv > ... (4 Replies)
Discussion started by: gerkus
4 Replies

5. Shell Programming and Scripting

Removing lines of a .csv file

Hello, Does anyone have a one-liner to remove lines of a csv file if the value in a specific column is zero? For example, I have this file, 12345,COM,5,0,N,29.95,Y 12345,MOM,1,0,N,29.95,Y 12345,COM,4,0,N,9.99,Y 12345,MOM,0,2,N,9.99,Y 12345,REN,0,1,N,9.99,Y and I want to remove lines... (4 Replies)
Discussion started by: palex
4 Replies

6. Shell Programming and Scripting

Removing zero values from text file

Hi all, I wrote the following code to remove the value which are 0 in the input file (a columns if numbers). awk 'BEGIN { for (i=1; i<=NF; i++) if ($i) printf("%13.6e\n",$i) }' $1 >> $2 The script works if the zeros are written as 0.0000 but not as 0.000000e+00 In... (10 Replies)
Discussion started by: f_o_555
10 Replies

7. Shell Programming and Scripting

removing lines with similar values from file

Hello, got a file with this structure: 33274 171030 02/29/2012 37897 P_GEH 2012-02-29 10:31:26 33275 171049 02/29/2012 38132 P_GEH 2012-02-29 10:35:27 33276 171058 02/29/2012 38515 P_GEH 2012-02-29 10:43:26 33277 170748 02/29/2012 40685 P_KOM ... (3 Replies)
Discussion started by: krecik28
3 Replies

8. Shell Programming and Scripting

Removing \n from .csv file

Hi, I have a requirement like my .csv file is generating from a db2 table using export command like below: file format: ----------- 2011 4 0 0 N S C C "BHPC BHPC" 0 0 0 2011 5 0 0 N S C C "BHPC BHPC" 0 0 0 here BHPC is having new line character and because this when i am trying... (4 Replies)
Discussion started by: RRVARMA
4 Replies

9. Shell Programming and Scripting

Bash script help - removing certain rows from .csv file

Hello Everyone, I am trying to find a way to take a .csv file with 7 columns and a ton of rows (over 600,000) and remove the entire row if the cell in forth column is blank. Just to give you a little background on why I am doing this (just in case there is an easier way), I am pulling... (3 Replies)
Discussion started by: MrTuxor
3 Replies

10. UNIX for Beginners Questions & Answers

Removing commas from CSV file

Hi I'm creating a sh script to generate a csv file. The CSV contains the values from a sql table. The content looks this: a,b,c,c2,c3,,,,,,,,,,,d,e I have some code that can separate the fields using the comma as delimiter, but some values actually contain commas, such as... (2 Replies)
Discussion started by: preema
2 Replies
Imager::Font::Wrap(3pm) 				User Contributed Perl Documentation				   Imager::Font::Wrap(3pm)

NAME
Imager::Font::Wrap - simple wrapped text output SYNOPSIS
use Imager::Font::Wrap; my $img = Imager->new(xsize=>$xsize, ysize=>$ysize); my $font = Imager::Font->new(file=>$fontfile); my $string = "..."; # text with or without newlines Imager::Font::Wrap->wrap_text( image => $img, font => $font, string => $string, x => $left, y => $top, width => $width, .... ); DESCRIPTION
This is a simple text wrapper with options to control the layout of text within the line. You can control the position, width and height of the text with the "image", "x", "y", "width" and "height" options. You can simply calculate space usage by setting "image" to "undef", or set "savepos" to see how much text can fit within the given "height". wrap_text() Draw word-wrapped text. o "x", "y" - The top-left corner of the rectangle the text is formatted into. Defaults to (0, 0). o "width" - The width of the formatted text in pixels. Defaults to the horizontal gap between the top-left corner and the right edge of the image. If no image is supplied then this is required. o "height" - The maximum height of the formatted text in pixels. Not required. o "savepos" - The amount of text consumed (as a count of characters) will be stored into the scalar this refers to. my $pagenum = 1; my $string = "..."; my $font = ...; my $savepos; while (length $string) { my $img = Imager->new(xsize=>$xsize, ysize=>$ysize); Imager::Font::Wrap->wrap_text(string=>$string, font=>$font, image=>$img, savepos => $savepos) or die $img->errstr; $savepos > 0 or die "Could not fit any text on page "; $string = substr($string, $savepos); $img->write(file=>"page$pagenum.ppm"); } o "image" - The image to render the text to. Can be supplied as "undef" to simply calculate the bounding box. o "font" - The font used to render the text. Required. o "size" - The size to render the font in. Defaults to the size stored in the font object. Required if it isn't stored in the font object. o "string" - The text to render. This can contain non-white-space, blanks (ASCII 0x20), and newlines. Newlines must match /(?:x0Ax0D?|x0Dx0A?)/. White-space other than blanks and newlines are completely ignored. o "justify" The way text is formatted within each line. Possible values include: o "left" - left aligned against the left edge of the text box. o "right" - right aligned against the right edge of the text box. o "center" - centered horizontally in the text box. o fill - all but the final line of the paragraph has spaces expanded so that the line fills from the left to the right edge of the text box. o "linegap" - Gap between lines of text in pixels. This is in addition to the size from "$font->font_height". Can be positive or negative. Default 0. Any other parameters are passed onto Imager::Font->draw(). Returns a list: ($left, $top, $right, $bottom) which are the bounds of the space used to layout the text. If "height" is set then this is the space used within that height. You can use this to calculate the space required to format the text before doing it: my ($left, $top, $right, $bottom) = Imager::Font::Wrap->wrap_text(string => $string, font => $font, width => $xsize); my $img = Imager->new(xsize=>$xsize, ysize=>$bottom); Imager::Font::Wrap->wrap_text(string => $string, font => $font, width => $xsize, image => $image); BUGS
Imager::Font can handle UTF-8 encoded text itself, but this module doesn't support that (and probably won't). This could probably be done with regex magic. Currently ignores the "sizew" parameter, if you supply one it will be supplied to the draw() function and the text will be too short or too long for the "width". Uses a simplistic text model, which is why there's no hyphenation, and no tabs. AUTHOR
Tony Cook <tony@develop-help.com> SEE ALSO
Imager(3), Imager::Font(3) perl v5.14.2 2011-06-06 Imager::Font::Wrap(3pm)
All times are GMT -4. The time now is 04:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy