Sponsored Content
Top Forums Shell Programming and Scripting Need a helping hand --stuck in starting of this problm. Post 302088734 by jambesh on Thursday 14th of September 2006 07:25:24 AM
Old 09-14-2006
Need a helping hand --stuck in starting of this problm.

Hi all it is a real challenge for me to do it in 2 days any help or suggestion will be a great !
Problem : I have 17 - CSV files (Coma separated value)
each file conating around 26 column
the first line of each of the file conatin the field name and from second line
the file contain data for each of column heading.

for each of the file there are different mandatory column
like for BASIC_DATA there is mandatory column 1,2,3,4,5,6,10,11
this column must be having data for each of the rows if any of the columns don't have value then this file should be requested to resend .

Here is sample file structure of one of those file

'MBRASH','RMMG1-MTART','RMMG1-MATNR','MAKT-MAKTX','MARA-MEINS','MARA-MAKTL','MARA-BISMT','MARA-LABOR','MARA-KOSCH','MARA-PRDHA','MARA-MTPOS_MARA','MARA-EAN11','MARA-NUMTP','MARA-PRZUS','MARA-FERTH','MARA-NORMT','MARA-FORMT','MARA-WRKST','MARA-PROFL','MARA_KZUMW','MARA_IHIVI','MARA_ILOOS','MARA-ZEINR','MARA_SATNR','MARA_KZKFG'
Chemical,ZMAT-SFM,B12366497,PVAT66 BULK STRGE,KG,CHEM,,,,G2,NORM,,,,,,,,,,,,,,
Chemical,ZMAT-SFM,B12366404,PVA 7130 BULK RC,KG,CHEM,,,,G2,NORM,,,,,,,,,,,,,,
Chemical,ZMAT-SFM,B12366520,VAC BULK STRGE,KG,CHEM,,,,G2,NORM,,,,,,,,,,,,,,
Chemical,ZMAT-FPM,D12766771,ELVANOL T66 22.7KG / 50 LB BAG,KG,CHEM,,,,G2,NORM,,,,,,,,,,,,,,
Chemical,ZMAT-RM,D10270736,ACETIC ACID GLACIAL PLN,KG,CHEM,,,,G2,NORM,,,,,,,,,,,,,,
Chemical,ZMAT-RM,D10000905,METHYL METHACRYLATE 99.5% TKT,KG,CHEM,,,,G2,NORM,,,,,,,,,,,,,,
Chemical,ZMAT-RM,D10057585,DOW CORNING H-10 DEFOAMER DRM,KG,CHEM,,,,G2,NORM,,,,,,,,,,,,,,



The first row actually contain the column heading and the second row onward it contain data for it.

I want to find out if colume 1 ,column2 ,column 3 ,column 4, column 5,column 6 , column 10 ,column 11 has data for each of the row ??
if any row misses data for the mandatory column then
i should mail the owner that data missing.


Please need the help.
I want to write a function for this where i can pass the file name and the mandatory column for this file
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need a hand. Please?

i have a script in sh. with awk, e.g. want to list all the contents of a subdirectory an a tabular way. ej: outoput directory1 subdirectory1 subdirectory2 subdirectory3 file1 filen file2 filez file2 ... filen+1 ... (1 Reply)
Discussion started by: alexcol
1 Replies

2. IP Networking

helping new Linux users remotely ?

I volunteer with a small charity which locally donates refurbished computers to people who normally could not afford their own computer. Most of these computers now have Linux on them. We are in the process of remastering Xubuntu 9.04 to use as our main distro from now on. In the past any time... (3 Replies)
Discussion started by: lagagnon
3 Replies

3. Shell Programming and Scripting

Helping in parsing subset of text from a big results file

Hi All, I need some help to effectively parse out a subset of results from a big results file. Below is an example of the text file. Each block that I need to parse starts with "reading sequence file 10.codon" (next block starts with another number) and ends with **p-Value(s)**. I have given... (1 Reply)
Discussion started by: Lucky Ali
1 Replies

4. Shell Programming and Scripting

cut operation is not helping me much

hi, i have a file where I want to extract the the failure count only from the file. JOB_NAME STATE RUN_COUNT FAILURE_COUNT ------------------------------ --------------- ---------- ------------- OFS_BALA_BILLING_IN SCHEDULED 22992 ... (6 Replies)
Discussion started by: gotam
6 Replies

5. Shell Programming and Scripting

Merge left hand strings mapping to different right hand strings

Hello, I am working on an Urdu to Hindi dictionary which has the following structure: a=b a=c n=d n=q and so on. i.e. Headword separated from gloss by a = I am giving below a live sample بتا=बता بتا=बित्ता بتا=बुत्ता بتان=बतान بتان=बितान بتانا=बिताना I need the following... (3 Replies)
Discussion started by: gimley
3 Replies

6. Shell Programming and Scripting

Helping a Newbie with Shell Homework

Good Evening, i got a homework where i have to list all files in the directory with the name length >=3 and <= 6 and after trying it for 2 days my Prof gave me a bit of code: #!/bin/bash for file in $(ls) do done after that he told me "now you only have to use wc and you got it" but... (1 Reply)
Discussion started by: Mentoss
1 Replies

7. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies
SMRSH(8)						      System Manager's Manual							  SMRSH(8)

NAME
smrsh - restricted shell for sendmail SYNOPSIS
smrsh -c command DESCRIPTION
The smrsh program is intended as a replacement for sh for use in the ``prog'' mailer in sendmail(8) configuration files. It sharply limits the commands that can be run using the ``|program'' syntax of sendmail in order to improve the over all security of your system. Briefly, even if a ``bad guy'' can get sendmail to run a program without going through an alias or forward file, smrsh limits the set of programs that he or she can execute. Briefly, smrsh limits programs to be in a single directory, by default /etc/smrsh, allowing the system administrator to choose the set of acceptable commands, and to the shell builtin commands ``exec'', ``exit'', and ``echo''. It also rejects any commands with the characters ``', `<', `>', `;', `$', `(', `)', ` ' (carriage return), or ` ' (newline) on the command line to prevent ``end run'' attacks. It allows ``||'' and ``&&'' to enable commands like: ``"|exec /usr/local/bin/procmail -f- /etc/procmailrcs/user || exit 75"'' Initial pathnames on programs are stripped, so forwarding to ``/usr/ucb/vacation'', ``/usr/bin/vacation'', ``/home/server/mydir/bin/vaca- tion'', and ``vacation'' all actually forward to ``/etc/smrsh/vacation''. System administrators should be conservative about populating the /etc/smrsh directory. Reasonable additions are vacation(1), procmail(1), and the like. No matter how brow-beaten you may be, never include any shell or shell-like program (such as perl(1)) in the /etc/smrsh directory. Note that this does not restrict the use of shell or perl scripts in the sm.bin directory (using the ``#!'' syntax); it simply disallows execution of arbitrary programs. FILES
/etc/smrsh - directory for restricted programs SEE ALSO
sendmail(8) $Date: 2002/04/25 13:33:40 $ SMRSH(8)
All times are GMT -4. The time now is 04:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy