0

Hi i have two files in the staging location.

  1. /projects/staging/mvn_file_data_001.csv, /projects/staging/mvn_file_data_002.csv, /projects/staging/mvn_file_data_003.csv /projects/staging/mvn_file_data_00n.csv- these files contains the complete data row wise.

corresponding to these files i have

  1. /projects/staging/loaded_mvn_file_001.call, /projects/staging/loaded_mvn_file_002.call /projects/staging/loaded_mvn_file_003.call /projects/staging/loaded_mvn_file_00n.call

First i have to move the all the csv files to a temp location

temporary_csv =/projects/staging/temp_csv/

Second i have to move all the .call file to a temporary location

temporary_ok=/projects/staging/temp_ok

Now i have to compare these file which i have done using the if clause

now i have for loop for traversing the csv filehave defined variables

for i in {temporary_csv} - this will pick up all the file name with csv extension

count_csv = cat $i|wc -l

count_ok = i have found a way to fetch the count in ok files i dont remember right now.

the main issue is i have applied a an if clause

if [ $count_csv==$count_ok ] ; then i want move the csv files back to staging location after validation

i.e /projects/staging/

else

move the file into bad directory

i.e /projects/bad

fi

done

now i have to take the validate this for multiple file is my above statement with the for loop correct for traversing the file and checking the record count or there is something else required.

  • What shell are you proposing to use for this? The syntax does not match any shell that I'm aware of. Are you asking about the general algorithm? Could you pleas clarify the actual question? – Kusalananda Mar 27 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.