![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Spliting file based on condition | Raamc | Shell Programming and Scripting | 2 | 05-15-2008 08:51 AM |
| How to parse through a file and based on condition form another output file | sivasu.india | UNIX for Advanced & Expert Users | 6 | 02-28-2008 12:59 AM |
| Read file based on condition | sbasetty | Shell Programming and Scripting | 5 | 01-31-2007 10:54 PM |
| Splitting a file based on some condition and naming them | srivsn | Shell Programming and Scripting | 1 | 12-07-2005 07:27 AM |
| awk script to split a file based on the condition | superprogrammer | Shell Programming and Scripting | 12 | 06-14-2005 12:59 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Moving file to directory based on condition.
Can any one help me to correct following script.
I have 2 directories DropZone and ProcessZone. File pattern is *VEHDESCSUM*. Finding the 'no of files' in DropZone directory using ls *VEHDESCSUM* |wc -l If DropZone has more than one file or 0 files then exit 1 If DropZone has one file then move file from DropZone to ProcessZone. I am trying with the following code. But I am getting errors. #!/bin/sh ########################################################## DROP_ZONE=/apps/dsadm/GMCCi2/DropZone PROCESS_ZONE=/apps/dsadm/GMCCi2/ProcessZone echo ${DROP_ZONE} echo ${PROCESS_ZONE} cd $DROP_ZONE cnt = ls *VEHDESCSUM* |wc -l echo ${cnt} if [ cnt -gt 1 ] then exit 1 else mv $DROP_ZONE/*VEHDESCSUM* $PROCESS_ZONE exit 0 fi ########################################################## thanks for all |
| Forum Sponsor | ||
|
|
|
|||
|
I have done changes above script. But still getting errors: "argument expected" Could you please any one correct my script.
======================================== DROP_ZONE=/apps/dsadm/GMCCi2/DropZone PROCESS_ZONE=/apps/dsadm/GMCCi2/ProcessZone echo ${DROP_ZONE} echo ${PROCESS_ZONE} cd $DROP_ZONE echo FILE_COUNT = ls *VEHDESCSUM* |wc -l if [ $FILE_COUNT -ne 1 ] then exit 1 else mv $DROP_ZONE/*VEHDESCSUM* $PROCESS_ZONE exit 0 fi ================================= |
|||
| Google The UNIX and Linux Forums |