Detect Invalid Data by C shell


 
Thread Tools Search this Thread
Operating Systems Solaris Detect Invalid Data by C shell
# 1  
Old 06-15-2010
Data Detect Invalid Data by C shell

Dear all,

I'd be so grateful if I could get great feedback again for my problems.

We usually spool some text files from our system in csv format.
Unfortunately, some data contains ',' (comma) and it's rare case but when it comes to spool, that row included comma should be invalid data, due to extra comma, as you can imagine.
We can't prevent to be input comma, due to strong users' request, so we decided to enclose " (double-quotation) each fields in further development.

I'm just wondering if we can check the comma counts of each current spool files and detect the invalid data included or not.

If you would have any good command or shell to work on this, pls advise me.

Thanks,
# 2  
Old 06-21-2010
Can you please try putting some data here to see what can be customized.
thanks
# 3  
Old 06-23-2010
Hi busyboy,Thanks for your advice.

Let me try to give you simple sample for what we'd like to do.
In case we have 4 columns from A to D, the delimitar should be 3.
But if B columns contains comma like 3rd row, this comma should be judged as delimitar, not usual character in csv format. We'd like to detect the invalid row with extra delimitar compaired to the other rows.

FieldA | FieldB|FieldC|FieldD
---------------------------
AAA,BBB,CCC,DDD
AA,BB,CC,DDD
AAA,BB,B,CCCC,DDDD -- NG ROW

We'd like to detect third row as invalid row with extra delimitar.
I'm wondering if we can use awk command to detect extra delimitar but so far I'm out of resources.

I'd be grateful if you could give me any little advice.
Thank you.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tomcat failure detect via shell

Team, I am able to get ERROR message from my shell script, but sometime few severe error happen that tomcat server not started or not responding. How do we can detect it via shell script ? here is my snippet I used for my case tail -n0 -F $catalinaPath | while read line; do if echo... (0 Replies)
Discussion started by: Ghanshyam Ratho
0 Replies

2. Shell Programming and Scripting

Detect current shell inside a script

I wish to print my current shell which happens to be bash in my script check.sh more check.sh echo $0 echo `ps -p $$` But instead of printing it prints check.sh i.e the name of the script for both the commands. Can you please suggest how to print the current shell i m on inside the... (2 Replies)
Discussion started by: mohtashims
2 Replies

3. AIX

/tmp/man18809436: Invalid file system control data detected

/tmp/man18809436: Invalid file system control data detected Help me what do I do? Если знаете русскии, пишите на нем. (2 Replies)
Discussion started by: islily
2 Replies

4. Shell Programming and Scripting

How to detect Hanged process in shell script?

I have to check daily 20 processes each day. The names are like Network1 Network2 Network3 ....... Network20. There is built in utility for doing this. Following is the command to check a single network process. check_process_status 1 If we want to check the status of Network2 then the... (6 Replies)
Discussion started by: Nakul_sh
6 Replies

5. Shell Programming and Scripting

How to detect key press in cgi shell script?

I want to detect key pressed in my .cgi web page, but it does not work even I found the code in other web site. My code is : #!/bin/sh #================================================= # PATH defination # ================================================... (2 Replies)
Discussion started by: Shuinvy
2 Replies

6. Shell Programming and Scripting

Shell Scripting Problem - Invalid Back Reference

Here is the question... Create a new script, sub2, taking three parameters... 1.) the string to be replaced 2.) the string with which to replace it 3.) the name of the file in which to make the substitution ...that treats the string to be replaced as plain text instead of as a regular... (1 Reply)
Discussion started by: johnhisenburg
1 Replies

7. UNIX for Advanced & Expert Users

Shell to detect the end of file

Hi. I'm not UNIX expert, I need to do a shell to read a sequential file and show in the console the record numbers read, until the end of file. The reason of this shell is to be sure if the file is not corrupt. Thanks (1 Reply)
Discussion started by: hornam
1 Replies

8. Shell Programming and Scripting

01.30 Invalid shell error

Hi, I am getting the error 01.30 Invalid shell error I am running the bash shell script in the korn login shell. I have mentioned the #!/bin/bash statement in the my script but not sure why it is giving this error to me.. (4 Replies)
Discussion started by: mr_harish80
4 Replies

9. Shell Programming and Scripting

Menus in Korn Shell and invalid selections

Hey Guys. I need to code a series of menus that have four options, selectable either by the number in the menu or the name, in succession. This part I have achieved however I am struggling to find a way that should the user try to enter an invalid selection, such as the number 5 or an incorrect... (5 Replies)
Discussion started by: Mudja
5 Replies

10. Solaris

invalid compressed data--crc error

I am getting this error when trying to unzip a file.gz . Anyone know how to resolve this ? (3 Replies)
Discussion started by: jxh461
3 Replies
Login or Register to Ask a Question