Sponsored Content
Top Forums Shell Programming and Scripting Replace CRLF between pipe (|) delimiter with LF Post 303009324 by hishamzz on Tuesday 12th of December 2017 02:37:03 PM
Old 12-12-2017
Quote:
Originally Posted by RudiC
Sorry I keep nagging. How are the lines separated, and how differs that from the in-field control characters? Sure there's NO <LF> char?
Please post the output of
Code:
od -tx1c file

.
No worries Rudi! I am the needy one here hehe..

Code:
0000000  32  30  31  36  2d  31  31  2d  33  30  7c  32  30  31  36  2d
          2   0   1   6   -   1   1   -   3   0   |   2   0   1   6   -
0000020  32  30  31  37  7c  32  30  31  36  2d  31  31  2d  33  30  7c
          2   0   1   7   |   2   0   1   6   -   1   1   -   3   0   |
0000040  31  32  33  34  7c  73  6f  6d  65  66  69  6c  65  2e  74  78
          1   2   3   4   |   s   o   m   e   f   i   l   e   .   t   x
0000060  74  7c  50  72  6f  64  75  63  74  69  6f  6e  7c  4e  6f  7c
          t   |   P   r   o   d   u   c   t   i   o   n   |   N   o   |
0000100  7c  7c  4c  4f  7c  7c  43  65  6e  74  65  72  7c  7c  4e  6f
          |   |   L   O   |   |   C   e   n   t   e   r   |   |   N   o
0000120  7c  7c  7c  31  32  33  34  7c  49  6d  70  6f  72  74  61  6e
          |   |   |   1   2   3   4   |   I   m   p   o   r   t   a   n
0000140  74  7c  3c  20  24  32  30  20  4d  69  6c  6c  69  6f  6e  7c
          t   |   <       $   2   0       M   i   l   l   i   o   n   |
0000160  51  75  61  72  74  65  72  6c  79  7c  7c  7c  7c  32  30  31
          Q   u   a   r   t   e   r   l   y   |   |   |   |   2   0   1
0000200  31  2d  30  32  2d  32  34  7c  7c  7c  53  6f  6d  65  20  64
          1   -   0   2   -   2   4   |   |   |   S   o   m   e       d
0000220  65  73  63  72  69  70  74  69  6f  6e  20  68  65  72  65  7c
          e   s   c   r   i   p   t   i   o   n       h   e   r   e   |
0000240  0d  0a  0d  0a  0d  0a  0d  0a  0d  0a  0d  0a  55  70  64  61
         \r  \n  \r  \n  \r  \n  \r  \n  \r  \n  \r  \n   U   p   d   a
0000260  74  65  20  73  6f  6d  65  74  68  69  6e  67  7c  74  65  73
          t   e       s   o   m   e   t   h   i   n   g   |   t   e   s
0000300  74  66  69  6c  65  2e  74  78  74  7c  48  69  73  68  61  6d
          t   f   i   l   e   .   t   x   t   |   H   i   s   h   a   m
0000320  0d  0a
         \r  \n
0000322

Sample record of how it appears in the file. The CRLF can honestly appear in any one of the columns prior to the last.

Zz
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cutting a portion of a line seperated by pipe delimiter

Hi, In the below line a|b|10065353|tefe|rhraqs|135364|5347575 dgd|rg|4333|fhra|grhrt|46423|urdsgd Here i want to cut the characters in between the second and third pipe delimiter and then between fifth and sixth delimiter and retain the rest of the line. My output should be ... (3 Replies)
Discussion started by: ragavhere
3 Replies

2. Shell Programming and Scripting

Converting hex value 7C (for pipe) to CRLF in Unix

I am trying to convert a txt file that includes one long string of data. The lines are separated with hex value 7C (for pipe). I am trying to process this file using SQR (Peoplesoft) so I thought the easiest thing to do would be to replace the eol char with a CRLF in unix so I can just... (4 Replies)
Discussion started by: sfedak
4 Replies

3. UNIX for Dummies Questions & Answers

replacing space with pipe(delimiter)

Hello All, I have a file with thousands of records: eg: |000222|123456987|||||||AARONSON| JOHN P|||PRIMARY |P |000111|567894521|||||||ATHENS| WILLIAM k|||AAAA|L Expected: |000222|123456987|||||||AARONSON| JOHN |P|||PRIMARY |P |000111|567894521|||||||ATHENS| WILLIAM |k|||AAAA|L I... (6 Replies)
Discussion started by: OSD
6 Replies

4. Shell Programming and Scripting

Replace pipe with Broken Pipe

Hi All , Is there any way to replace the pipe ( | ) with the broken pipe (0xA6) in unix (1 Reply)
Discussion started by: saj
1 Replies

5. UNIX for Dummies Questions & Answers

[Solved] How to swap PIPE seperator delimiter?

I have file like below 1|4|OR|OLAP|INT|INT||CONSTANT|2012/08/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|55791|LNR| 2|4|OR|OLAP|CLR|CLR||CONSTANT|2012/09/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|57891|REGS|... (2 Replies)
Discussion started by: gkskumar
2 Replies

6. Red Hat

Converting fixed width file to pipe delimiter in Linux(red-hat)

Hi, I am facing a typical scenario for AWK command . In HP- UNIX is behave as expected but in red hat linux same awk code is not give the same result. The below code is for convert the fixed width file to pipe delimiter file in HP-unix server. awk code: #!/bin/awk -f NR!=1... (11 Replies)
Discussion started by: brij_abhi
11 Replies

7. Shell Programming and Scripting

Removing duplicate lines on first column based with pipe delimiter

Hi, I have tried to remove dublicate lines based on first column with pipe delimiter . but i ma not able to get some uniqu lines Command : sort -t'|' -nuk1 file.txt Input : 38376KZ|09/25/15|1.057 38376KZ|09/25/15|1.057 02006YB|09/25/15|0.859 12593PS|09/25/15|2.803... (2 Replies)
Discussion started by: parithi06
2 Replies

8. Shell Programming and Scripting

Problem in using cut command with pipe as a delimiter while using in a script

There is a text file in my project named as "mom.txt" in which i want to have contents like.................. LSCRM(Application Name): 1: This is my first application. 2: Today we did shell scripting automation for this app. 3: It was really a good fun in doing so. 4: Really good.| (Here i... (7 Replies)
Discussion started by: Abhijeet Anand
7 Replies

9. UNIX for Beginners Questions & Answers

Views How to replace a CRLF char from a variable length file in the middle of a string in UNIX?

My sample file is variable length, with out any field delimiters. It has min of 18 chars length and the 'CRLF' is potentially between 12-14 chars. How do I replace this with a space? I still want to keep end of record, but just want to remove these new lines chars in the middle of the data. ... (7 Replies)
Discussion started by: chandrath
7 Replies

10. Shell Programming and Scripting

Replace delimiter for a particular column in a pipe delimited file

I have an input file as below Emp1|FirstName|MiddleName|LastName|Address|Pincode|PhoneNumber 1234|FirstName1|MiddleName2|LastName3| Add1 || ADD2|123|000000000 Output : 1234|FirstName1|MiddleName2|LastName3| Add1 ,, ADD2|123|000000000 OR 1234,FirstName1,MiddleName2,LastName3, Add1 ||... (2 Replies)
Discussion started by: styris
2 Replies
Locale::Codes::LangExt(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangExt(3pm)

NAME
Locale::Codes::LangExt - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangExt; $lext = code2langext('acm'); # $lext gets 'Mesopotamian Arabic' $code = langext2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langext_codes(); @names = all_langext_names(); DESCRIPTION
The "Locale::Codes::LangExt" module provides access to standard codes used for identifying language extensions, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language extensions. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langext('acm','alpha'); $lext = code2langext('acm',LOCALE_LANGEXT_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from the IANA language registry, such as 'acm' for Mesopotamian Arabic. This is the default code set. ROUTINES
code2langext ( CODE [,CODESET] ) langext2code ( NAME [,CODESET] ) langext_code2code ( CODE ,CODESET ,CODESET2 ) all_langext_codes ( [CODESET] ) all_langext_names ( [CODESET] ) Locale::Codes::LangExt::rename_langext ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangExt::add_langext ( CODE ,NAME [,CODESET] ) Locale::Codes::LangExt::delete_langext ( CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_alias ( NAME ,NEW_NAME ) Locale::Codes::LangExt::delete_langext_alias ( NAME ) Locale::Codes::LangExt::rename_langext_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::delete_langext_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-11-04 Locale::Codes::LangExt(3pm)
All times are GMT -4. The time now is 04:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy