Sponsored Content
Top Forums Shell Programming and Scripting Need Help to delete carriage return and new line in csv file Post 302942963 by mlavanya on Monday 4th of May 2015 10:38:25 AM
Old 05-04-2015
Need Help to delete carriage return and new line in csv file

Hi All,

I have a problem loading the data from a csv file
As you see below in the Input ,For the Data starting with " there are 2 lines, which i want to make them into single without changing the format of that data.
You can see the desired output below:
While i try to open the csv file and see the could see the whole text in a single column, but when i try to see in edit plus only i see that data after "Order raised to credit back overpayment against order 0981/1571Q." is going to next line and im not able to load the data .

Header for the file has some 13 columns, im getting this problem with 9th column in the file

Input :
Code:
12345|477.5|C|123/1234|12345678|1234|1234/1234567|Emergency Lighting|"Order raised to credit back overpayment against order1233/12345.
Hi Abcd
 Could you please arrange credit for the above as follows £123
 The wrong quote was uploaded against this job but the correct works have been carried out.  If you need paperwork to confirm let me know and I will forward it on to you 
 Many thanks
 Kind Regards,
Abcdedfg
Admin & Invoicing Team Member
12345 567898"|ABCDEFGH|16/12/2014|1234|ABCD1010

Desired Output :

Code:
12345|477.5|C|123/1234|12345678|1234|1234/1234567|Emergency  Lighting|"Order raised to credit back overpayment against  order1233/12345.Hi AbcdCould you please arrange credit for the above as follows £123The  wrong quote was uploaded against this job but the correct works have  been carried out.  If you need paperwork to confirm let me know and I  will forward it on to you Many thanks
 Kind Regards,AbcdedfgAdmin & Invoicing Team Member12345 567898"|ABCDEFGH|16/12/2014|1234|ABCD1010


I want the system consider the text starting " to the text ending with " as a single line.

Could anyone please help me out with the solution for this.

Regards,
Lavanya.

Last edited by Scrutinizer; 05-04-2015 at 12:26 PM.. Reason: CODE tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

carriage return/line feeds

Hello, I have a file that has got carriage returns in it and I want to take them out. Anyone know how I can do this in a ksh? thanks (4 Replies)
Discussion started by: pitstop
4 Replies

2. Shell Programming and Scripting

Removing Carriage Return and or line feed from a file

Hello I'm trying to write a shell script which can remove a carriage return and/or line feed from a file, so the resulting file all ends up on one line. So, I begin with a file like this text in file!<CR> line two!<CR> line three!<CR> END!<CR> And I want to end up with a file... (1 Reply)
Discussion started by: tbone231
1 Replies

3. Shell Programming and Scripting

How to insert carriage return before line feed?

I am doing some edi where translations had to be run on unix. Generally when I run the translations on windows, the output file has both carriage returns and line feed where as when ran on unix will have only line feed. I need to insert carriage return before the line feed. Is there some tool... (2 Replies)
Discussion started by: huey ing
2 Replies

4. Shell Programming and Scripting

How to delete carriage return in SED

Could someone tell me how to do the below without opening the file? (eg in sed or awk) I have a file with the contenst below: $ more file1.txt 10 AAA; 200 BBB; 3 CCC; I want to delete the carriage return of one line above the line which has ";" at the end to get the... (3 Replies)
Discussion started by: stevefox
3 Replies

5. UNIX for Dummies Questions & Answers

To remove carriage return between the line

Hi, I have a situation where I need to remove the carriage return between the lines. For.eg. The input file: 1,ad,"adc sdfd",edf 2,asd,"def fde",asd The output file should be 1,ad,adc sdfd,edf 2,asd,def fde,asd Thanks Shash (5 Replies)
Discussion started by: shash
5 Replies

6. Shell Programming and Scripting

Delete carriage return in SED

Hi everybody! I'm working in one script with sed, I have file with the next content: <voms.db.type value="changeme"/> <voms.db.host value="changeme"/> <voms.admin.smtp.host value="changeme"/> <voms.mysql.admin.password value="changeme"/> <glite.installer.verbose value="true"/> ... (3 Replies)
Discussion started by: juedsivi
3 Replies

7. Shell Programming and Scripting

Need a carriage return at end of each line

Hi All, I am reading two files and writing out the file name and count of lines in each file to an output file. My script looks like this: echo "input_file1.out;`wc -l < input_file1.out | sed 's/^]*\(.*\)]*$/\1/'` " > comp_file1.out echo "input_file2.out;`wc -l < input_file2.out | sed... (2 Replies)
Discussion started by: Hangman2
2 Replies

8. Shell Programming and Scripting

Why sed command deletes last line in a file if no carriage return?

Hi I am using sed command to make SCORE=somevalue to SCORE=blank in a file. Please see the attached lastline.txt file. After executing the below command on the file, it removes the last line. cat lastline.txt | sed 's/SCORE=.*$/SCORE=/g' > newfile.txt Why does sed command remove the... (3 Replies)
Discussion started by: ashok.k
3 Replies

9. Shell Programming and Scripting

line carriage return characters

Hi, I would like to insert the line carriage retrun characters on each line. (2 Replies)
Discussion started by: koti_rama
2 Replies

10. UNIX for Beginners Questions & Answers

Remove newlines and carriage return from a csv file using UNIX

I need to remove new lines and carriage returns from csv file. Is there anything other than sed and gwak by which we could achieve this ? Any suggestions ? (3 Replies)
Discussion started by: A_Gaddale
3 Replies
SVN::Notify::HTML(3pm)					User Contributed Perl Documentation				    SVN::Notify::HTML(3pm)

Name
       SVN::Notify::HTML - Subversion activity HTML notification

Synopsis
       Use svnnotify in post-commit:

	 svnnotify --repos-path "$1" --revision "$2" 
	   --to developers@example.com --handler HTML [options]

       Use the class in a custom script:

	 use SVN::Notify::HTML;

	 my $notifier = SVN::Notify::HTML->new(%params);
	 $notifier->prepare;
	 $notifier->execute;

Description
       This subclass of SVN::Notify sends HTML formatted email messages for Subversion activity, rather than the default plain text.

Prerequisites
       In addition to the modules required by SVN::Notify, this class requires:

       HTML::Entities

Usage
       To use SVN::Notify::HTML, simply follow the instructions in SVN::Notify, but when using svnnotify, specify "--handler HTML".

Class Interface
   Constructor
       new

	 my $notifier = SVN::Notify::HTML->new(%params);

       Constructs and returns a new SVN::Notify object. All parameters supported by SVN::Notity are supported here, but SVN::Notify::HTML supports
       a few additional parameters:

       linkize
	     svnnotify --linkize

	   A boolean attribute to specify whether or not to "linkize" the SVN log message--that is, to turn any URLs or email addresses in the log
	   message into links.

       css_url
	     svnnotify --css-url http://example.com/svnnotify.css

	   URL for a CSS file that will can style the HTML output by SVN::Notify::HTML or its subclasses. Note that the URL will be added to the
	   output via a "<link rel="stylesheet">" tag after the CSS generated by SVN::Notify::HTML or its subclasses. What that means is that the
	   CSS file specified by "css_url" need not completely style the HTML, but simply override the default settings. This approach nicely
	   takes advantage of the "cascading" abilities of CSS.

       ticket_map
	     svnnotify --ticket-map '(BUG-(d+))=http://bugs.example.com/?show=%s'

	   This attribute is inherited from SVN::Notify, but its semantics are slightly different: the regular expression passed as the regular
	   expression used for the key should return two matches instead of one: the text to link and the ticket ID itself. For example,
	   '(BUG-(d+))' will match "BUG-1234567", and "BUG-1234567" will be used for the link text, while "1234567" will be used to fill in the
	   "ticket_url" format string. The first set of parentheses capture the whole string, while the parentheses around "d+" match the number
	   only. Also note that it is wise to use "" on either side of the regular expression to insure that you don't get spurious matches.	So
	   a better version would be '(BUG-(d+))'.

	   As a fallback, if your regular expression returns only a single match string, it will be used both for the link text and for the the
	   ticket URL generated from "ticket_url". For example, 'BUG-(d+)' would make a link only of the number in 'BUG-1234567', as only the
	   number has been captured by the regular expression. But two matches are of course recommended (and likely to work better, as well).

	   You can use more complicated regular expressions if commit messages are likely to format ticket numbers in various ways. For example,
	   this regular expression:

	     [?s*(Tickets*#s*(d+))s*]?'

	   Will match:

	      String Matched	       Link Text	Ticket Number
	     --------------------|--------------------|---------------
	      [Ticket#1234]	    [Ticket#1234]	1234
	      [ Ticket # 1234 ]     [ Ticket # 1234 ]	1234
	      Ticket #1234	    Ticket #1234	1234
	      Ticket # 1234	    Ticket  #1234	1234

	   In any of these cases, you can see that the match is successful, properly creates the link text (simply using the text as typed in by
	   the committer, and correctly extracts the ticket number for use in the URL.

	   To learn more about the power of Regular expressions, I highly recommend _Mastering Regular Expressions, Second Edition_, by Jeffrey
	   Friedl.

       wrap_log
	     svnnotify --wrap-log

	   A boolean attribute to specify whether or not to wrap the log message in the output HTML. By default, log messages are not wrapped, on
	   the assumption that they should appear exactly as typed. But if that's not the case, specify this option to wrap the log message.

   Class Methods
       content_type

       Returns the content type of the notification message, "text/html". Used to set the Content-Type header for the message.

Instance Interface
   Instance Methods
       start_html

	 $notifier->start_html($file_handle);

       This method starts the HTML of the notification message. It outputs the opening "<html>", "<head>", and "<body>" tags. Note that if the
       "language" attribute is set to a value, it will be specified in the
	"<html>" tag.

       All of the HTML will be passed to any "start_html" output filters. See Writing Output Filters for details on filters.

       start_body

       This method starts the body of the HTML notification message. It first calls "start_html()", and then outputs the "<style>" tag, calling
       "output_css()" between them. It then outputs an opening "<div>" tag.

       If the "header" attribute is set, "start_body()" outputs it between "<div>" tags with the ID "header". Furthermore, if the header happens
       to start with the character "<", "start_body()" assumes that it contains valid HTML and therefore will not escape it.

       If a "start_body" output filter has been specified, it will be passed the lines with the "<div>" tag and the header. To filter the CSS, use
       a "css" filter, and to filter the declaration of the HTML document and its "<head>" section, use a "start_html" filter. See Writing Output
       Filters for details on filters.

       output_css

	 $notifier->output_css($file_handle);

       This method starts outputs the CSS for the HTML message. It is called by "start_body()", and which wraps the output of "output_css()" in
       the appropriate "<style>" tags.

       An output filter named "css" may be added to modify the output of CSS. The filter subroutine name should be "css" and expect an array
       reference of lines of CSS. See Writing Output Filters for details on filters.

       output_metadata

	 $notifier->output_metadata($file_handle);

       This method outputs a definition list containing the meta data of the commit, including the revision number, author (user), and date of the
       revision. If the "revision_url" attribute has been set, then the appropriate URL for the revision will be used to turn the revision number
       into a link.

       If there are any "log_message" filters, this method will do no HTML formatting, but redispatch to SVN::Notify::output_metadata. See Writing
       Output Filters for details on filters.

       output_log_message

	 $notifier->output_log_message($file_handle);

       Outputs the commit log message in "<pre>" tags, and the label "Log Message" in "<h3>" tags. If the "bugzilla_url" attribute is set, then
       any strings like "Bug 2" or "bug # 567" will be turned into links.

       If there are any "log_message" filters, the filters will be assumed to escape the HTML, create inline links, and link ticket URLs.
       Otherwise, this method will do those things. See Writing Output Filters for details on filters.

       output_file_lists

	 $notifier->output_log_message($file_handle);

       Outputs the lists of modified, added, deleted, files, as well as the list of files for which properties were changed as unordered lists.
       The labels used for each group are pulled in from the "file_label_map()" class method and output in "<h3>" tags.

       If there are any "file_lists" filters, this method will do no HTML formatting, but redispatch to SVN::Notify::output_file_lists. See
       Writing Output Filters for details on filters.

       end_body

	 $notifier->end_body($file_handle);

       Closes out the body of the email by outputting the closing "</body>" and "</html>" tags. Designed to be called when the body of the message
       is complete, and before any call to "output_attached_diff()".

       If the "footer" attribute is set, "end_body()" outputs it between "<div>" tags with the ID "footer". Furthermore, if the footer happens to
       end with the character "<", "end_body()" assumes that it contains valid HTML and therefore will not escape it.

       All of the HTML will be passed to any "end_body" output filters. See Writing Output Filters for details on filters.

       output_diff

	 $notifier->output_diff($out_file_handle, $diff_file_handle);

       Sends the output of "svnlook diff" to the specified file handle for inclusion in the notification message. The diff is output between
       "<pre>" tags, and Each line of the diff file is escaped by "HTML::Entities::encode_entities()".	The diff data will be read from
       $diff_file_handle and printed to $out_file_handle.

       If there are any "diff" filters, this method will do no HTML formatting, but redispatch to SVN::Notify::output_diff. See Writing Output
       Filters for details on filters.

   Accessors
       In addition to those supported by SVN::Notify, SVN::Notify::HTML supports the following accessors:

       linkize

	 my $linkize = $notifier->linkize;
	 $notifier = $notifier->linkize($linkize);

       Gets or sets the value of the "linkize" attribute.

       css_url

	 my $css_url = $notifier->css_url;
	 $notifier = $notifier->css_url($css_url);

       Gets or sets the value of the "css_url" attribute.

See Also
       SVN::Notify

Author
       David E. Wheeler <david@kineticode.com>

Copyright and License
       Copyright (c) 2004-2009 Kineticode, Inc. Some Rights Reserved.

       This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

perl v5.10.1							    2011-03-15						    SVN::Notify::HTML(3pm)
All times are GMT -4. The time now is 09:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy