Sponsored Content
Top Forums Shell Programming and Scripting Removal of carriage returns from a comma delimited file Post 302489541 by mahish20 on Thursday 20th of January 2011 05:02:30 PM
Old 01-20-2011
Removal of carriage returns from a comma delimited file

Hi,

I have a file which is having some carriage return in one of the field for which single line is coming in multiple lines.

I want to combine all those multiple lines of that field into one line.

Eg:

Input:

Code:
 
Id, Name, Location, Comments, Dept
2, John, US, I am from US.
I live in NC.
I am working on Unix, Finance
3, Jack, UK, I am from UK.
I live in London, Accounts

Desired Output:

Code:
Id, Name, Location, Comments, Dept
2, John, US, I am from US.I live in NC.I am working on Unix, Finance
3, Jack, UK, I am from UK.I live in London, Accounts

Any solution for this would be of really helpful.. Thanks.

Mahesh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comma Delimited file

I have a comma delimited file that sometimes has addresses details in. The problem is that the address detail can be seen as: "Sample House, Sample Road". When I run a script specifying the file is comma delimited I would like it to ignore comma's that are in between speech marks. Is this... (2 Replies)
Discussion started by: dbrundrett
2 Replies

2. Shell Programming and Scripting

Converting Tab delimited file to Comma delimited file in Unix

Hi, Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies

3. UNIX for Advanced & Expert Users

Issue with Removing Carriage Return (^M) in delimited file

Hi - I tried to remove ^M in a delimited file using "tr -d "\r" and "sed 's/^M//g'", but it does not work quite well. While the ^M is removed, the format of the record is still cut in half, like a,b, c c,d,e The delimited file is generated using sh script by outputing a SQL query result to... (7 Replies)
Discussion started by: sirahc
7 Replies

4. Shell Programming and Scripting

removal of return carriage baffling me?

hi ALL, bash-3.00$ echo $BASH_VERSION 3.00.16(1)-release I'm stumped on a bug. Im extracting a checksum value at the end of a file and storing it in a variable, the problem is that it is also somehow storing the carriage return in the string as show below: The variables below both... (4 Replies)
Discussion started by: satnamx
4 Replies

5. Shell Programming and Scripting

removing carriage returns in text file

Hi I have a text file that looks like this: A B C D E F G H I I want it to be reformatted to A;B;C; D;E;F; G;H;I; (4 Replies)
Discussion started by: coolnfunky
4 Replies

6. UNIX for Dummies Questions & Answers

Comma delimited file

Hi All, I have output of sql saved in comma separated file. Now i need to read line by line this file and assign word to a unix variable for further processing Eg: Test file world, 1, 3, 4 earth,2,3,4,5 moon,1,2,3,4 Output should be word1= world word2=1 echo " first word... (7 Replies)
Discussion started by: gwrm
7 Replies

7. Emergency UNIX and Linux Support

Adding carriage returns to file using sed/awk

Hello, I need help adding carriage returns at specific intervals (say 692 characters) to a text file that's one continous string. I'm working in AIX5.3. Any quick help is appreciated. Thanks! (2 Replies)
Discussion started by: bd_joy
2 Replies

8. UNIX for Advanced & Expert Users

Add a Couple of Carriage returns to text file

I have a directory of over a hundred text files that I'm getting ready to merge with the CAT command. However there is only one space after each file; this makes the output look crowded. I would like to add two, possibly even four carriage returns at the end of each text file to make the final... (2 Replies)
Discussion started by: tg3793
2 Replies

9. Shell Programming and Scripting

sed returns different results while substitution on a pipe delimited file

Hi, Need help with a sed command that I am using to substitute 3 positions of a pipe delimited file. i am getting different results while substituting the same position of two different files with the same value. Please see details below: $ cat chk2 ... (3 Replies)
Discussion started by: vmenon
3 Replies

10. Shell Programming and Scripting

TR not removing carriage returns

I have a CSV with carriage returns in place of newlines. I am trying to use tr to remove them, but it isn't working. Academic year,Term,Course name,Period,Last name,Nickname 2012-2013,First Semester,English 12,4th Period,Arnold,Adam 2012-2013,First Semester,English 12,4th Period,Adams,Jim... (1 Reply)
Discussion started by: nextyoyoma
1 Replies
DISTRIB.PATS(5) 						File Formats Manual						   DISTRIB.PATS(5)

NAME
distrib.pats - default values for Usenet Distribution header DESCRIPTION
The file /etc/news/distrib.pats is used to determine the default value of the Distribution header. It consists of a series of lines; blank lines and lines beginning with a number sign (``#'') are ignored. All other lines consist of three fields separated by a colon: weight:pattern:value The first field is the weight to assign to this match. If a newsgroup matches multiple lines, the line with the heighest weight is used. This should be an arbitrary number greater than zero. Unlike other INN files, the order of lines in this file is not important. The second field is the name of the newsgroup or a wildmat(3)-style pattern to specify a set of newsgroups. Multiple patterns are not allowed. The third field is the value that should be used if this line is picked as the best match. It can be an empty string. Programs such as inews(1) that process a user's posting should consult this file, typically by using the DDxxx routines, documented in lib- inn(3). The intent is that all newsgroups to which an article is posted be used to index into this file, and the value with the highest weight should be used as the value of the Distribution header, if none was specified. HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. This is revision 1.7, dated 1996/09/06. SEE ALSO
inews(1), libinn(3). DISTRIB.PATS(5)
All times are GMT -4. The time now is 09:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy