Sponsored Content
Top Forums Shell Programming and Scripting File name and format validation Post 302393955 by vsmeruga on Wednesday 10th of February 2010 06:19:22 AM
Old 02-10-2010
Thanks. I will try and know about it

---------- Post updated at 05:01 AM ---------- Previous update was at 04:40 AM ----------

Hi Malcome

Thanks for the quick reply. Let me re frame my question again.

Actually, I have 3 mandatory fields among the list of fields in a file. I should not get the values as NULL for those 3 fields

Mandatory Fields are : Feild1, Field4, Field5

If i find any NULL values in those 3 fields. I need to write the message to log as "Mandatory field : Field Num coming as NULL. File cannot be processed"

---------- Post updated at 06:19 AM ---------- Previous update was at 05:01 AM ----------

Hi trying to execute below script with script file name as interface_main_script.sh
and getting the error as below:

Code:
user prompt: ksh interface_main_script.sh
interface_main_script.sh[6]: syntax error at line 14 : `elif' unexpected

Please let me know my mistake.

interface_main_script.sh:

Code:
#!/bin/ksh
#set -x

BASE=/grid/PowerCenter/stage/velocity_r3/inbound/ATRPU

for file in `find $BASE -type f `
do
  FN=`basename $file`
  intname = $FN |grep "^[A-Z]\{5\}"  
  if $intname= 'ATRPU' then 
	echo "ATRPU Interface"
       #./AT_VELUNIX01_SRV01_inbound_ftp.sh ${intname}
  elif  $intname= 'ATRGI' then 
	echo "ATRGI Interface"
       #./AT_VELUNIX01_SRV01_inbound_ftp.sh ${intname}
  else
	echo "Not valid Interface Files"
   fi
done


Last edited by Franklin52; 02-10-2010 at 07:24 AM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unix File Validation! Help

Hi All, I got a file with 3 fields delimited by hyphen "-". I have to validate & cleanse the data before i begine the processing Requirements 1. No record should contain more than 2 delimiters 2. No record should even contain less than 2 delimiters 3. Any records that matches rule 1 &... (8 Replies)
Discussion started by: minnuverma
8 Replies

2. UNIX for Dummies Questions & Answers

File Validation

Hi All, I am new to UNIX scripting. I need to validate a file. I need to check whether the file has a header , detail records and footer. If all the file is good I need to create a status file with the status 'Y' else 'N'. I have pasted the an example of the file below: ... (5 Replies)
Discussion started by: kumar66
5 Replies

3. UNIX for Dummies Questions & Answers

file name with timestamp validation

Hi , I am trying to write a shell script which will validate all .csv file names in a directory , my file name format is as below. CDR_SCAN_Report_YYYYMMDDHHMI.csv 1. I need to validate the name should start with CDR_SCAN_Report. 2. And the time stamp part is a valid time stamp,if it is... (1 Reply)
Discussion started by: shruthidwh
1 Replies

4. Shell Programming and Scripting

File Name Validation

Hi All, I am trying to validate the file name against the naming convention mentioned in configuration file. In the configuration file, the file name convention is mentioned as: Myfile_SQ<NN>_<NN>_YYYYMMDD_HHMMSS.xml The actual file received is Myfile_SQ10_30_20110423_073002.xml How do... (1 Reply)
Discussion started by: angshuman
1 Replies

5. Shell Programming and Scripting

File validation

Hello, File contains 1,3 and 5 are required columns. it's working use this command. awk -F\| '$1 && $3 && $5' test1.txt > test2.txt How can use this unix programming.while using runnign this scirpt,it's raising the error. awk: ^ syntax error #!/usr/bin/ksh `awk -F\| '$1 &&... (3 Replies)
Discussion started by: bammidi
3 Replies

6. Shell Programming and Scripting

XML file validation

Hi, i am new to unix script. i have two xml files. one is orderinfo.xml and another one is xsd file(EmailMessage.xml). we need to compare the both file for poper nodes exists are not. for example: <xsd:element name="EmailMessage"> tag in the EmailMessage.xml file(xsd sheet),this tag... (2 Replies)
Discussion started by: bmk
2 Replies

7. Shell Programming and Scripting

File validation

Hi there, As a part of file validation, I needed to check for delimiter count in the file. My aim is to find, how many records have failed to have predefined numbers of delimiters in the file. My code looks like below i=`awk -F '|' 'NF != 2 {print NR, $0} ' ${pinb_fldr}/${pfile}DAT |... (3 Replies)
Discussion started by: anandapani
3 Replies

8. Shell Programming and Scripting

Validation of date from file name

I'm writing a shell script for cleanup of older files from various sub-directories inside a main directory The structure of directories is as below: Logs daily online archive weekly online archive... (1 Reply)
Discussion started by: asyed
1 Replies

9. UNIX for Dummies Questions & Answers

Validation before moving the File

Hi, Before moving the files from source directory to target directory I need to check if the files have these strings 'Error', 'Not Valid' ,' YTF-' or if the file is a zero byte file, if the file contains these strings or if it is a zero byte file i should log a entry in the log file and fail... (5 Replies)
Discussion started by: gaur.deepti
5 Replies

10. UNIX for Beginners Questions & Answers

Flat File Validation

Hi Team there is a requirement to do validate on Flat files using Shell Scripting. Suppose we have two flat files ( F1, F2). Validation 1. Row count between F1 and F2 a) Write it in a file with results of count of each file and differences if any 2. Apply checksum or any... (1 Reply)
Discussion started by: shlearner
1 Replies
t_sysconf(3NSL) 				       Networking Services Library Functions					   t_sysconf(3NSL)

NAME
t_sysconf - get configurable XTI variables SYNOPSIS
#include <xti.h> int t_sysconf(intname); DESCRIPTION
The t_sysconf() function provides a method for the application to determine the current value of configurable and implementation-depen- dent XTI limits or options. The name argument represents the XTI system variable to be queried. The following table lists the minimal set of XTI system variables from <xti.h> that can be returned by t_sysconf(), and the symbolic constants, defined in <xti.h> that are the corresponding values used for name. +-----------------------------+-----------------------------+ | Variable | Value of Name | +-----------------------------+-----------------------------+ |T_IOV_MAX |_SC_T_IOV_MAX | +-----------------------------+-----------------------------+ RETURN VALUES
If name is valid, t_sysconf() returns the value of the requested limit/option, which might be -1, and leaves t_errno unchanged. Other- wise, a value of -1 is returned and t_errno is set to indicate an error. VALID STATES
All. ERRORS
On failure, t_errno is set to the following: TBADFLAG name has an invalid value. TLI COMPATIBILITY
In the TLI interface definition, no counterpart of this routine was defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
sysconf(3C), t_rcvv(3NSL), t_rcvvudata(3NSL), t_sndv(3NSL), t_sndvudata(3NSL), attributes(5) SunOS 5.11 7 May 1998 t_sysconf(3NSL)
All times are GMT -4. The time now is 11:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy