Sponsored Content
Top Forums Shell Programming and Scripting Need Help to delete carriage return and new line in csv file Post 302942973 by mlavanya on Monday 4th of May 2015 11:51:59 AM
Old 05-04-2015
Hi Scrutinizer,

The data which i have posted is actually a single row with 13 columns separated with pipe symbol(|)

I need the data with in double quotes to be considered as single column.
that is from Order raised to 12345 567898
As of now i see that line "Order raised to credit back overpayment against order1233/12345" is treated as 1 column and "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 567898Hi 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 is treated as next line

Input :
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:
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



Please let me know if this is clear. Else please do let me know ..

Regards,
Lavanya.

---------- Post updated at 09:21 PM ---------- Previous update was at 09:19 PM ----------

Hi Rudic ,

Will try the same,

Thanks for your reply..

Regards,
Lavanya.
 

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
Appender::Socket(3pm)					User Contributed Perl Documentation				     Appender::Socket(3pm)

NAME
Log::Log4perl::Appender::Socket - Log to a socket SYNOPSIS
use Log::Log4perl::Appender::Socket; my $appender = Log::Log4perl::Appender::Socket->new( PeerAddr => "server.foo.com", PeerPort => 1234, ); $appender->log(message => "Log me "); DESCRIPTION
This is a simple appender for writing to a socket. It relies on IO::Socket::INET and offers all parameters this module offers. Upon destruction of the object, pending messages will be flushed and the socket will be closed. If the appender cannot contact the server during the initialization phase (while running the constructor "new"), it will "die()". If the appender fails to log a message because the socket's "send()" method fails (most likely because the server went down), it will try to reconnect once. If it succeeds, the message will be sent. If the reconnect fails, a warning is sent to STDERR and the "log()" method returns, discarding the message. If the option "silent_recovery" is given to the constructor and set to a true value, the behaviour is different: If the socket connection can't be established at initialization time, a single warning is issued. Every log attempt will then try to establish the connection and discard the message silently if it fails. If you don't even want the warning, set the "no_warning" option to a true value. Connecting at initialization time may not be the best option when running under Apache1 Apache2/prefork, because the parent process creates the socket and the connections are shared among the forked children--all the children writing to the same socket could intermingle messages. So instead of that, you can use "defer_connection" which will put off making the connection until the first log message is sent. EXAMPLE
Write a server quickly using the IO::Socket::INET module: use IO::Socket::INET; my $sock = IO::Socket::INET->new( Listen => 5, LocalAddr => 'localhost', LocalPort => 12345, Proto => 'tcp'); while(my $client = $sock->accept()) { print "Client connected "; while(<$client>) { print "$_ "; } } Start it and then run the following script as a client: use Log::Log4perl qw(:easy); my $conf = q{ log4perl.category = WARN, Socket log4perl.appender.Socket = Log::Log4perl::Appender::Socket log4perl.appender.Socket.PeerAddr = localhost log4perl.appender.Socket.PeerPort = 12345 log4perl.appender.Socket.layout = SimpleLayout }; Log::Log4perl->init($conf); sleep(2); for(1..10) { ERROR("Quack!"); sleep(5); } 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 Appender::Socket(3pm)
All times are GMT -4. The time now is 09:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy