Help with UNIX file data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with UNIX file data
# 1  
Old 01-11-2016
Help with UNIX file data

Hi all,

We get data in the form of file(1.5gb) (*.csv) and it is fixed length file with 5 delimiters & 5 columns
for example
Code:
rec1_1<;|rec1_2<;|rec1_3<;|rec1_4<;|rec1_5<;|

the above rec1 is perfect example that our process accepts it for execution.

but for few records we are now getting some
1) part of data in new line
2) that part starts with Tabs(x3 tabs or x6 tabs)

These Tabs are unwanted and the split should not take place.

the example records are:

Code:
 rec2_1<;|rec2_2<;|rec2_3<;|rec2_4<;|
    <;|
    rec3_5
<;|
    rec4_5 <;|
ISX_SEARCH_FILTER_WINDOW<;|E<;|A<;|0000<;|
       Type      : Combinatie van foutc<;|

Here in this the last record is real example but somehow Tabs are replaced with spaces here.

we now want to exclude such records before processing them and capture them in some file.

can any one help me
1) why those splits are taking in new line
2) why unnecessary tabs are embedded with the other parth of recor in new line
3) & How to identify those records and direct them to a reject file.

We Access those records with NLS_lang = UTF-16LE without which it is immpossible to see the data.

Thanks

Last edited by Don Cragun; 01-11-2016 at 03:27 AM.. Reason: Add CODE tags.
# 2  
Old 01-11-2016
Quote:
Originally Posted by shharrath
Hi all,

We get data in the form of file(1.5gb) (*.csv) and it is fixed length file with 5 delimiters & 5 columns
for example
Code:
rec1_1<;|rec1_2<;|rec1_3<;|rec1_4<;|rec1_5<;|

the above rec1 is perfect example that our process accepts it for execution.

but for few records we are now getting some
1) part of data in new line
2) that part starts with Tabs(x3 tabs or x6 tabs)

These Tabs are unwanted and the split should not take place.

the example records are:

Code:
 rec2_1<;|rec2_2<;|rec2_3<;|rec2_4<;|
    <;|
    rec3_5
<;|
    rec4_5 <;|
ISX_SEARCH_FILTER_WINDOW<;|E<;|A<;|0000<;|
       Type      : Combinatie van foutc<;|

Here in this the last record is real example but somehow Tabs are replaced with spaces here.

we now want to exclude such records before processing them and capture them in some file.

can any one help me
1) why those splits are taking in new line
Presumably, the file you are processing came from somewhere. You need to examine the source of that data to determine why it is incorrectly formatted. You have given us absolutely no information that would enable us to determine why the source of your data is incorrectly formatting your data.
Quote:
2) why unnecessary tabs are embedded with the other parts of record in new line
Presumably, the file you are processing came from somewhere. You need to examine the source of that data to determine why it is incorrectly formatted. You have given us absolutely no information that would enable us to determine why the source of your data is incorrectly formatting your data.
Quote:
3) & How to identify those records and direct them to a reject file.
Code:
awk -F '<;[|]' 'NF!=6' input_file.csv > malformed_records_file.csv

Quote:
We Access those records with NLS_lang = UTF-16LE without which it is impossible to see the data.

Thanks
What operating system are you using? On UNIX and Linux and BSD based systems, you might want something like LC_CTYPE=UTF-16LE. Setting an environment variable with spaces around the equals-sign is not correct syntax for shell commands. Maybe there is something else going on here that would help us understand what environment is being used to process your data???
# 3  
Old 01-11-2016
Moderator's Comments:
Mod Comment Putting this to "Shell Scripting", where it belongs.


bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

2. Shell Programming and Scripting

Manipulation of file data with UNIX

Hello , How all doing today.. I have a little doubt in Unix (6 Replies)
Discussion started by: adisky123
6 Replies

3. Shell Programming and Scripting

Extracting data into flat file thru unix

Hi, I need to extract a oracle staging table to a flat file thru unix batch process.We are expecting more than 4million records in the table.I know I can do it using "UTL_FILE" .But,since "UTL_FILE" takes a lot of time I am looking for better options.Can any body suggest some better options? ... (3 Replies)
Discussion started by: Beena
3 Replies

4. UNIX for Dummies Questions & Answers

UNIX - File/Table/Data manipulation

Hi, I have a table (e.g.): a 1 e 4 5 6 b 2 r 4 4 2 c 5 r 3 7 1 d 9 t 4 4 9 . . What I need to do is to set the values of some values in column 2 to negative values. For example, the values 2 and 9 should become -2 and -9 in the modified file. How should I go about... (2 Replies)
Discussion started by: pc2001
2 Replies

5. UNIX for Dummies Questions & Answers

Validating XSL sheet data in Unix Data file

Dear All, Need your help. In my day to day activities I have to validate/search Excel Sheet data (eg.say Application No. 0066782345) data into the Unix environment file whether the same data is present in that file or not. There are hundreds of records coming in excel file and I am doing grep... (1 Reply)
Discussion started by: ravijunghare
1 Replies

6. Shell Programming and Scripting

Help on email data file as excel from unix!!

Hi, I need to email a data in excel sheet from unix using shell scripting.I could able to generate the data file with tab delimiter with extension .xls could able to email it. The problem is when a coulmn with 16 digit number is exported, it is showing in scientific format. Any help in... (1 Reply)
Discussion started by: sparan_peddu
1 Replies

7. Shell Programming and Scripting

unix script to takes the old data from a TXT file and compress them into new file

Hi, I am looking for the unix script which can takes the 2 month old data from a TXT file (there is one txt file in whiche messages are appended on daily basis) and compress them into new file.Please halp me out. (2 Replies)
Discussion started by: vpandey
2 Replies

8. Shell Programming and Scripting

How to fetch data from a text file in Unix

I want to fetch passwords from a common file xxxx.txt and use it in a script. Currently the password is hardcoded so this have to be changed so that password can be fetched from text file..... Please reply asap.. Thanks (4 Replies)
Discussion started by: shikhakaul
4 Replies

9. UNIX for Dummies Questions & Answers

How to export data file from Unix

Hi, I am searching a way to export data file on Unix to SQL server on a daily bases. Any one has any ideas? Thanks in advance! (20 Replies)
Discussion started by: whatisthis
20 Replies

10. UNIX for Dummies Questions & Answers

How to copy data file from UNIX and put it on PC

Hello, My customer wants me to copy a data file from his UNIX box, and transfer to windows basic PC. My question is how can I find the file in UNIX box, copy it out into DOS/Windows format. Please help. Thanks (3 Replies)
Discussion started by: BillyT
3 Replies
Login or Register to Ask a Question