Special control characters in file

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Special control characters in file
# 1  
Old 09-05-2014
Special control characters in file

Hi Guys,

We receive some huge files on to Linux server. Source system use FTP mechanism to transfer these files on our server. Occasionally one record is getting corrupted while transfer, some control characters are injecting into the file. How to fix this issue ? please advice ?

Sample Corrupted Record:

Code:
A|06/02/2013|11/03/2013|90|90|90|92|90|99|99|1|90-90-90-92-90-99-99|90-90-90-92-90-99-99-1|FX|US|6|289814345|289814345|SBC AMERITECH|FX|||US|532024303|U108024050|AT&T INC.|FX|US|1||D31887602||FX|US|0||N|N|S|0|||0|0|0||||D|0||152745w]M-LM-^G|599001.74|0|0|FX|FDFR|

Correct Record is as follows:

Code:
A|06/02/2013|11/03/2013|90|90|90|92|90|99|99|1|90-90-90-92-90-99-99|90-90-90-92-90-99-99-1|FX|US|6|289814345|289814345|SBC AMERITECH|FX|||US|532024303|U108024050|AT&T INC.|FX|US|1||D31887602||FX|US|0||N|N|S|0|||0|0|0||||D|0||152745444.00|599001.74|0|0|FX|FDFR|


Last edited by jim mcnamara; 09-05-2014 at 05:48 PM..
# 2  
Old 09-05-2014
Is this really corruption or is it due to the file having been written using the wrong language settings or UTF settings?

A lot of Linux systems have the iconv command to convert from one NLS setting to another.

Usually "corruption" via ftp or sftp transfer is a seldom thing. Can you get a checksum of a corrupted file, then a checksum on the remote source file to verify that transfer did not corrupt.

If you want a script it would be a one-time deal, because corruption due to file transfers does not cause the same screw-ups in the data time after time. Because of that, scripting is not a great solution. If you have enough virtual memory, the Linux vim editor or an editor on a Windows desktop like Ultraedit is a better choice.

If you are getting the same kind of corruption it is very likely the garbage you see was already in the file before you got it, because of a programming error in the code that created the file, like buffer overflow. Consider fixing the root cause.

And. Yeah, I know -- the people on the creation side of things will fight the idea. But that is politics not computing.

Last edited by jim mcnamara; 09-05-2014 at 06:03 PM..
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 09-08-2014
Thank you Jim, i will check check sum with source and let you know how it goes.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing a file containing special characters

I want to parse a file containing special characters, below is a sample content of file content of file : Serial_no:1$$@#first_name:Rahane$$@last_name:Ajiyenke@@#profession:cricketer!@#*&^ Serial_no:1$$@#first_name:Rahane$$@last_name:Ajiyenke@@#profession:cricketer!@#*&^... (3 Replies)
Discussion started by: rajMjar
3 Replies

2. UNIX for Dummies Questions & Answers

Naming file with special characters ?

Hi all, I have a problem with file naming in linux. I have to create a file named like 11/22.csv but shell displays error: no such file or dir. Problem is / character in the file name. I searched unix linux naming concepts and it's restricted in OS. Please tell me if there's any other chance? OS... (3 Replies)
Discussion started by: sembii
3 Replies

3. Shell Programming and Scripting

How to view the control characters in a file?

Hello, How can I view control and special characters of a text file?. For example, space, tabs, new line chars etc. Can I use hexdump for it? Thanks (3 Replies)
Discussion started by: reddyr
3 Replies

4. Shell Programming and Scripting

Substitute special Characters into a file

Hi experts :) I need to replace special characters into a file , in the followiing way : " --> "" ' --> '' _--> \_ I tried with the sed command but I'm getting and error ksh: $: not found. ksh: $: not found. sed: Function s/\/\/ cannot be parsed. Any idea ? Thanks , KOLAS... (2 Replies)
Discussion started by: Kolas79
2 Replies

5. Shell Programming and Scripting

File containing special characters

Hello All, I am facing challenges in order to transfer a file from windows to unix box,the file contains a special character '×' ,now when I am transferring the file from windows to unix that special character converted to something else like 'Ã' ,another thing I have noticed that the hardware is... (1 Reply)
Discussion started by: prarat
1 Replies

6. Shell Programming and Scripting

Removing special characters - Control M

I have developed a small script to remove the Control M characters that get embedded when we move any file from Windows to Unix. For some reason, its not working in all scenarios. Some times I still see the ^M not being removed. Is there anything missing in the script: cd ${inputDir}... (7 Replies)
Discussion started by: vskr72
7 Replies

7. Shell Programming and Scripting

Is there anyway to grep any special characters from a file ?

Is there any command or shell script to grep any special character from a file ? I have a huge file containing millions of user names; the requirement is to find names containing special characters. #!/bin/bash for i in `cat username.txt` do #COMMAND to grep special character done ... (3 Replies)
Discussion started by: poga
3 Replies

8. Programming

Problem with control file and special character

I am getting error when loading data file using ctl file. I get this error only when there is special character. Below is some data. DataFile=> company_id|ciu_id|english_name|iso_country_code|active|partner_name 1-2JT-122||Expert Järvenpää|FI|A|Expert Järvenpää Control File=> LOAD DATA... (1 Reply)
Discussion started by: rshivarkar
1 Replies

9. UNIX for Dummies Questions & Answers

Replace Special characters in a file

Hi, I have a data like this in a file, 402003279034002000100147626030003300010000000000002000029000000 ær^M^\MÍW^H I need to replace those special char to some other char like # or $ Is there any ways to do it... I tried commands tr,sed and many but it was not able to replace because... (1 Reply)
Discussion started by: solai
1 Replies

10. UNIX for Dummies Questions & Answers

how to see special characters in a file using vi

Hi, I have a file which has special characters. I can't see them when I "vi" the file. But I am sure there are some special un seen characters. How can I see them? Please help. Thx (6 Replies)
Discussion started by: jingi1234
6 Replies
Login or Register to Ask a Question