Sponsored Content
Top Forums Shell Programming and Scripting Removing Embedded Newline from Delimited File Post 302269541 by manikantants on Thursday 18th of December 2008 02:03:40 AM
Old 12-18-2008
Not very clear.
Could you paste a sample input record and expected output record for the same.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed in removing intermediate segments from a pipe delimited segment file

Hi, I just stuckup in doing some regular expressions on a file. I have data which has multiple FHS and BTS segments like: FHS|12121|LOCAL|2323 MSH|10101|POTAMAS|2323 PID|121221|THOMAS|DAVID|23432 OBX|2342|H1211|3232 BTS|0000|MERSTO|LIABLE FHS|12121|LOCAL|2323 MSH|10101|POTAMAS|2323... (3 Replies)
Discussion started by: naren_0101bits
3 Replies

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

3. Shell Programming and Scripting

Removing blanks in a text tab delimited file

Hi Experts I am very new to perl and need to make a script using perl. I would like to remove blanks in a text tab delimited file in in a specfic column range ( colum 21 to column 43) sample input and output shown below : Input: 117 102 650 652 654 656 117 93 95... (3 Replies)
Discussion started by: Faisal Riaz
3 Replies

4. Shell Programming and Scripting

Read Embedded Newline characters with read (builtin) in KSH93

Hi Guys, Happy New Year to you all! I have a requirement to read an embedded new-line using KSH's read builtin. Here is what I am trying to do: run_sql "select guestid, address, email from guest" | while read id addr email do ## Biz logic goes here done I can take care of any... (6 Replies)
Discussion started by: a_programmer
6 Replies

5. Shell Programming and Scripting

Removing ^M and the newline that follows it.

Hi Gurus, Apologies as I feel like this must be answered already on here somewhere but I just can't find it. I find many people looking to remove all \n and \r (CR and LF) or one or the other but the only times I've found someone trying to remove them only when both are together they've found... (7 Replies)
Discussion started by: Leedor
7 Replies

6. Shell Programming and Scripting

Help with removing embedded linefeeds

Greetings all, i have csv file with pipe separated columns SSN|NAME|ADDRESS|FILLER 123|abc|myaddress|xxx 234|BBB|my add ress broken up|yyy In the example above, the second record is broken into multiple lines. I need to keep going until I find a "|" since this issue is with the... (14 Replies)
Discussion started by: stayalive
14 Replies

7. UNIX for Dummies Questions & Answers

Removing empty lines at the end of a Tab-delimited file

I'm trying to remove all of the empty lines at the end of a Tab delimited file. They have no data just tabs. I've tried may things, here are a couple: sed /^\t.\t/d File1 > File2 sed /^\t{44}/d File1 > File2 What am I missing? (9 Replies)
Discussion started by: SirHenry1
9 Replies

8. Shell Programming and Scripting

Removing dupes within 2 delimited areas in a large dictionary file

Hello, I have a very large dictionary file which is in text format and which contains a large number of sub-sections. Each sub-section starts with the following header : #DATA #VALID 1 and ends with a footer as shown below #END The data between the Header and the Footer consists of... (6 Replies)
Discussion started by: gimley
6 Replies

9. Shell Programming and Scripting

Script for removing newline character from file

Hi below is my file. cat input.dat 101,abhilash,1000 102,prave en,2000 103,partha,4 000 10 4,naresh,5000 (its just a example file) and my output should be: 101,abhilash,1000 102,praveen,2000 103,partha,4000 104,naresh,5000 below is my code cat input.dat |tr -d '\n' >... (6 Replies)
Discussion started by: abhilash_nakka
6 Replies

10. Shell Programming and Scripting

Removing duplicates from delimited file based on 2 columns

Hi guys,Got a bit of a bind I'm in. I'm looking to remove duplicates from a pipe delimited file, but do so based on 2 columns. Sounds easy enough, but here's the kicker... Column #1 is a simple ID, which is used to identify the duplicate. Once dups are identified, I need to only keep the one... (2 Replies)
Discussion started by: kevinprood
2 Replies
File::LocalizeNewlines(3pm)				User Contributed Perl Documentation			       File::LocalizeNewlines(3pm)

NAME
File::LocalizeNewlines - Localize the newlines for one or more files DESCRIPTION
For people that routinely work with a mixture of different platforms that have conflicting newline formats (mainly *NIX and Win32) there are a number of different situations that can result in files having their newlines get corrupted. File::LocalizeNewlines provides a mechanism for one off or bulk detection and conversion of these files to the newline style for the local platform. The module implements the conversion using a standard "universal line seperator" regex, which ensures that files with any of the different newlines, plus a couple of common "broken" newlines, including multiple different types mixed in the same file, are all converted to the local platform's newline style. METHODS
new param => value, ... The "new" constructor creates a new conversion object. By default, the conversion object will process all files and convert them to the local platform's newline format. Takes some optional parameters filter => File::Find::Rule The "filter" param allows you to provide an instantiate File::Find::Rule object, that will used to determine the list of files to check or process. newline => $newline The "newline" option allows you to provide an alternative newline format to the local one. The newline format should be provided as a literal string. For example, to force Win32 newlines, you would use my $Object = File::LocalizeNewlines->new( newline => "1512" ); verbose => 1 The "verbose" option will cause the "File::LocalizeNewlines" object to print status information to "STDOUT" as it runs. Returns a new "File::LocalizeNewlines" object. Find The "Find" accessor returns the File::Find::Rule object that will be used for the file search. newline The "newline" accessor returns the newline format that will be used in the localisation process. localized $file The "localized" method takes an argument of a single file name or file handle and tests it to see it is localized correctly. Returns true if localized correctly, false if not, or "undef" on error. find $dir The "find" method takes the path for a dir (or file) and returns a list of relative files names for all of the files that do not have their newlines correctly localized. Returns a list of file names, or the null list if there are no files, or if an incorrect path was provided. localize $file | $dir The "localize" method takes a file, file handle or directory as argument and localizes the newlines of the file, or all files within the directory (that match the filter if one was provided). Returns the number of files that were localized, zero if no files needed to be localized, or "undef" on error. SUPPORT
Bugs should always be submitted via the CPAN bug tracker <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-LocalizeNewlines> For other issues, contact the maintainer. AUTHOR
Adam Kennedy <adamk@cpan.org> ACKNOWLEDGEMENTS
Thank you to Phase N (<http://phase-n.com/>) for permitting the open sourcing and release of this distribution. FileHandle support added by David Dick <ddick@cpan.org> COPYRIGHT
Copyright 2005 - 2009 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.10.0 2009-06-25 File::LocalizeNewlines(3pm)
All times are GMT -4. The time now is 10:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy