03-29-2007
Repost-Korn Shell Scripting
Hi, being very new to Korn Shell Scripting I am hoping that someone here can help me. I want to compare file name in scp/inbox directory to file name stored inside a file in pnt/compare directory.
Hi, being very new to Korn Shell Scripting I am hoping that someone here can help me. I want to compare file name in scp/inbox directory to file name stored inside a file in pnt/compare directory.
1. Copy the first file name from the scp/inbox directory and insert into the pntcompare.dat. Then exit program.
2. Otherwise, if there is a file name pntcompare.dat in /pnt/compare directory then capture the first file name from the scp/inbox directory and compare to the file name's information stored inside the pntcompare.dat in /pnt/compare directory.
3. If they matched then remove the current file from the /scp/inbox directory to pnt/badfiles directory
4. Then create a badpnt.dat file and store the record information from file in /scp/inbox directory..
5. Next, remove the pntcompare.dat file from /pnt/compare directory.
6. Also remove the touch file (inputloop.touch) from Home directory.
7. If they not matched then remove contents in the pntcompare.dat then exit.
Here is an example of the file name pnt.20070327083828.000000066
Here is what I can come up so far, please help.
file=`/$ROOTDIR/pnt/compare -name 'pntcompare.dat' -print`
if [ -z $file ] then
pntcnt=`ls -l /$ROOTDIR/scp/inbox | grep "PNT." | wc -l`
if [[ $pntcnt1 -gt 0 ]] then
ls /$ROOTDIR/scp/inbox | grep "PNT." > /$ROOTDIR/pnt/compare/pntcompare.dat
pntcnt=`wc -l /$ROOTDIR/scp/inbox/pntcompare.dat|awk '{print $1}`
curcnt=1
do
filename=`head -$curcnt /$ROOTDIR/pnt/compare/pntcompare.dat | tail -1`
exit
else
Please help!!!
Thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am about to take certification for "Unix Korn Shell Scripting", which is conducted by brain bench. ( http://www.brainbench.com/xml/bb/common/testcenter/taketest.xml?testId=46)
The test consists of 40 single and multiple choice questions that must be answered in 60 minutes. The pass mark... (0 Replies)
Discussion started by: eswasas
0 Replies
2. UNIX for Dummies Questions & Answers
Hi
I'm new to scripting and I don't know where to start. I need to create a script that needs to look for specific files in a specific folder then I need to return the filename, the recordcount, bytecount and checksums. Then I need to write these results into a new file.
I would appreciate... (2 Replies)
Discussion started by: th0123
2 Replies
3. Shell Programming and Scripting
Hello All,
Can someone help me to set a user's password from the script using korn shell. The password change is a one time password after user account creation.
I tried providing the input file as the value for password field but password change requires tty so my password from an input file... (3 Replies)
Discussion started by: solaix14
3 Replies
4. Shell Programming and Scripting
I have made the following simple script:
a=0
let a=$a+1
if "]
then mailx -s "Up" abc@yahoo.com
fi
When I run the above script, I get the following error:
# ./new.ksh
./new.ksh: ]: not found.
Please tell me how to use if here? (6 Replies)
Discussion started by: kamaldeep1986
6 Replies
5. Shell Programming and Scripting
I am attempting to learn shell programming using o'rielly book "Learning the Korn Shell".
I am finding it pretty difficult to do since the only access I have to unix boxes are running version 99 of ksh.
The book utilizes ksh93 and there appear to be many differences. I can't even follow along... (2 Replies)
Discussion started by: vedder191
2 Replies
6. UNIX for Advanced & Expert Users
I have a scenario to implement in Korn shell script. Here it is..
I need to compare two values to see whether they are same or not. The issue is that the values coming in for comparison can be a string or an integer which can be determined during run time only.
Which korn shell comparison... (2 Replies)
Discussion started by: vani123
2 Replies
7. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
There is a menu driven program and there are some fields to be achived
3. Display contents of all .lst files... (3 Replies)
Discussion started by: jainitai
3 Replies
8. Shell Programming and Scripting
#! /bin/ksh
while read line
do
if ] ; then
echo "no data"
continue;
fi
echo "performing operation on $line"
done < prg.txt (3 Replies)
Discussion started by: Juhi Kashyap
3 Replies
9. Shell Programming and Scripting
Does dialog box works on all kind of shells? I am using korn shell in Linux .
For me dialog is not working :) is there any particular syntax or do we need to have particular OS version or shell env?
#!/bin/ksh
dialog --title "create file" \
--backtitle "shell script practice" \... (1 Reply)
Discussion started by: NarayanaPrakash
1 Replies
10. Shell Programming and Scripting
Hi All,
Kindly help on the below issue ASAP. Its very urgent.
I have script in which we have below two lines for code and it is not working. Please help.
files_to_process="
abc_*.log
def_*.log
ghi_*.log
"
typeset -A dir_list ${files_to_process}
the script is failing in Linux... (3 Replies)
Discussion started by: tvbhkishore
3 Replies
LEARN ABOUT DEBIAN
beh_debug
BEH_DEBUG(3) BHL functions BEH_DEBUG(3)
ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in
Paris, France.
Web : http://asim.lip6.fr/recherche/alliance/
E-mail : alliance-users@asim.lip6.fr
NAME
beh_debug - BEH structures displayer-debugger
SYNOPSYS
void beh_debug (pnt, type)
void *pnt;
char *type;
PARAMETERS
pnt pointer of the structure to be displayed
type name of the structure to be displayed. type can be any of "befig", "beout", "bereg", "bemsg", "bepor", "begen", "berin", "bebus",
"beaux", "bebux", "biabl", "binode", "beder", "bequad", "abl", "integer", "long", "short", "character", "ptype", "chain"
DESCRIPTION
When called, beh_debug() displaies the structure pointed by pnt then, prints the line:
COMMAND >>
and waits for a command being entered by the user. If pnt is a NULL pointer or type doesn't represent a known structure, beh_debug() exits
without making any action.
To display the structure, beh_debug() prints a line per field. Fields containing immediate value (integer, character, string, ...) are dis-
played in the following form:
name_of_the_field : value_of_the_field
Fields containing a pointer are marked by the symbol ->. If the field contains a NULL pointer, the field is displayed as:
-> name_of_the_field :
In the other case, beh_debug() prints :
-> name_of_the_field : available
Two kinds of command are accepted by the displayer.
A command can be the name of a field containing a pointer. The command is accepted only if the pointer is not a NULL pointer (field dis-
played as "available"). When the debugger receives such a command, it first pushes the current structure on its stack then, displaies the
structure pointed by the named field.
The second kind of commands are predefined commands :
_exit to exit from the debugger
_up to return to the previous structure
_stop to put a stop mark on the current structure
_top to return to the first structure (pointed by pnt)
_back to return to the last structure marked with a stop mark
_save to save the current structure in a static table. At most 10 structures may be saved. (example : "_save 1" saves the cur-
rent structure in the entry number ! of the table)
_jump to jump to a saved structure (example : "_jump 1" dislpaies the etructure save in the entry number 1 of the table).
_display displaies a field under a given format. (example : "_display next integer" displaies the field named next as an integer).
In addition to these commands, the command . (dot) can be used to repete the last command.
EXAMPLE
#include <beh109.h>
struct beout *beout_pnt;
beh_debug (beout_pnt , "beout");
NOTES
beh_debug() uses an internal stack. The message "stack overflow" is printed if too many structures have been pushed on the stack.
SEE ALSO
beh(3)
BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory.
We need your feedback to improve documentation and tools.
ASIM
/LIP6 October 1, 1997 BEH_DEBUG(3)