Sponsored Content
Operating Systems Linux Red Hat Converting fixed width file to pipe delimiter in Linux(red-hat) Post 302934285 by brij_abhi on Friday 6th of February 2015 01:35:33 AM
Old 02-06-2015
Hi rbattle,
sample data:
Code:
H721615296070R86593102170  999 OPN ID69                               20141117171817T1ZOR 700016901 4791032964                                    BVOM.ES@kk.COM                     20141117072  00  RE  DP20141031SYI1          074704700000532014111411B600*SAP01  Telefonica                              Avenida Punto Com, 23                                                                                                   ES 28805 Alcalá de Henares              TELEFONICA GLOBAL TECHNOLOGY S.A.       C/ Gran Vía 28                                                                                                          ES 28013 Madrid                         TELEFONICA GLOBAL TECHNOLOGY S.A.       C/ Gran Vía 28                                                                                                          ES 28013 Madrid                         HPT&CE3Z1                                       90592.78       113485.58 ECESDP28805       700020141117ORADIN13   0500701206    91717059  ZZ                                                                                                                     20141117173030BBWAT BBTO            20141117173030 0000000000000000 1.25270

Expected Output:
Code:
H7216152960|70R865931021|70  |999| OPN ID69                               |20141117171817|T1|ZOR |700016901 |4791032964                                    |BVOM.ES@kk.COM                     |20141117|07|2 | |00|  |RE|  |DP|20141031|SYI1          07|470|470|00|00|53|20141114|11|B600*SAP01  |Telefonica                              |Avenida Punto Com, 23                   |                                        |                                        |ES 28805 Alcalá de Henares              |TELEFONICA GLOBAL TECHNOLOGY S.A.       |C/ Gran Vía 28                          |                                        |                                        |ES 28013 Madrid                         |TELEFONICA GLOBAL TECHNOLOGY S.A.       |C/ Gran Vía 28                          |                                        |                                        |ES 28013 Madrid                         |HPT&C|E|3|Z1|                                |       90592.78 |      113485.58 |EC|ES|DP|28805       |7000|20141117|OR|ADIN13|   |0500701206|    |91717059  |ZZ|    |                                        |                        |                        |                        | |20141117173030|BB|WAT |BBTO            |20141117173030| |00000000|00000000| 1.25270 |

Hi rudic,
when i have used your code but in the second line it given me error . so i have execute your code till "file" only, it resolved the issue, output file contain that special character but it not give the expected result extra pipe delimiter coming, Please check the expected output. i have to put the condition as well as i have give in the previous post.

Please find the attachment for locale for both the machine.

Thanks.

Last edited by Franklin52; 02-06-2015 at 09:15 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

adding delimiter to a fixed width file

Hi , I have a file : CSCH74000.00 CSCH74000.00 CSCH74100.00 CSCH74000.00 CSCH74100.00 CSCH74000.00 CSCH74000.00 CSCH74100.00 CSCH74100.00 CSCH74100.00 I have to put a delimiter( say comma) in between after 6th character: CSCH74,000.00 CSCH74,000.00 CSCH74,100.00 (2 Replies)
Discussion started by: sumeet
2 Replies

2. Shell Programming and Scripting

Converting a Delimited File to Fixed width file

Hi, I have a delimited file generated by a database and i need to convert it to fixed width file using the field length of the database. Can any body suggest me how can i proceed with it? :confused: Thanks Raghavan (2 Replies)
Discussion started by: raghavan.aero
2 Replies

3. UNIX for Advanced & Expert Users

Converting field into fixed width csv

Hi I have a file having record as - 1,aaa,a123,a I need this converted to as 2nd col to 5 chars wide & 3rd col to 6chars wide such as - 1,aaa ,a123 ,a How we could achieve this? Thx in advance. (1 Reply)
Discussion started by: videsh77
1 Replies

4. UNIX Desktop Questions & Answers

Help with Fixed width File Parsing

I am trying to parse a Fixed width file with data as below. I am trying to assign column values from each record to variables. When I parse the data, the spaces in all coumns are dropped. I would like to retain the spaces as part of the dat stored in the variables. Any help is appreciated. I... (4 Replies)
Discussion started by: sate911
4 Replies

5. UNIX for Dummies Questions & Answers

cleaning up spaces from fixed width file while converting to csv file

Open to a sed/awk/or perl alternative so that i can stick command into my bash script. This is a problem I resolve using a combination of cut commands - but that is getting convoluted. So would really appreciate it if someone could provide a better solution which basically replaces all... (3 Replies)
Discussion started by: svn
3 Replies

6. Homework & Coursework Questions

File transfer from Red Hat Linux to Windows 7

My assignment is to use C++ to generate a table of values for the U.S. standard atmosphere, when data at sea level are given, which i have done perfectly. Now, i am attempting to create a matlab script to read and plot the data. I forgot to put my table of data on my thumb drive yesterday, and... (4 Replies)
Discussion started by: ds7202
4 Replies

7. Shell Programming and Scripting

Directory / File changes on CIFS share mounted on Red Hat Linux

I have a requirement to copy the changed file on CIFS share mounted on Red Hat Linux to a remote FTP/SFTP server. I tried inotify-tools, but this didn't track the modified files. Has anyone tried incron or any other suggestion? (1 Reply)
Discussion started by: SupeAlok
1 Replies

8. UNIX for Dummies Questions & Answers

Length of a fixed width file

I have a fixed width file of length 53. when is try to get the lengh of the record of that file i get 2 different answers. awk '{print length;exit}' <File_name> The above code gives me length 50. wc -L <File_name> The above code gives me length 53. Please clarify on... (2 Replies)
Discussion started by: Amrutha24
2 Replies

9. Shell Programming and Scripting

Alter Fixed Width File

Thank u so much .Its working fine as expected. ---------- Post updated at 03:41 PM ---------- Previous update was at 01:46 PM ---------- I need one more help. I have another file(fixed length) that will get negative value (ex:-00000000003000) in postion (98 - 112) then i have to... (6 Replies)
Discussion started by: vinus
6 Replies

10. Shell Programming and Scripting

Listing strings from file using awr Linux Red Hat

Hi experts, I have a file "salida_test" containing (in repetitive way): Point ID 1.750251 Point Name >BRI_4L_SA2__INT Interruptor 33kV Parque Industrial < value 2 Time of last value update (ascii): >03/07/17 11:11:14.596 ART< TLQ 0000000c00004000 station #79 ... (6 Replies)
Discussion started by: carlino70
6 Replies
All times are GMT -4. The time now is 10:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy