Adding numbers
Date: Fri, 09 Jul 1999 14:58:02 GMT
From: "manu b" manu024@hotmail.com
To: oraapps-dba@cpa.qc.ca
Subject: some unix's scripts??
Hi All,
I need to have a few unix shell scripts/directions for making some.
Basically my requirement is as follows:
I got a file which is having some numbers and I need to sum those to get the
output. The file will be like following:
12
23
56.7
I want a small shell script which can give me this.
thanks in advance..
Date: Fri, 9 Jul 1999 11:20:00 -0400
From: =?iso-8859-1?Q?Paul_Vall=E9e?= pvlists@pythian.com
Subject: Re: some unix's scripts??
You can use awk for this:
#!/bin/ksh
# awksum
# A quickie awk script by Paul Vallee, The Pythian Group
# Use: awksum < filename
# (at least in ksh), where filename is a text file where the first field is a
numeric value.
# Purpose: Sum up the first field of each line in a file.
awk '
{
sum += $1
}
END {
print "The sum is: ", sum;
}
'
# end of awksum
Best,
Paul
Date: Fri, 9 Jul 1999 11:26:29 -0400 Exit commands
Date: Mon, 12 Jul 1999 21:48:35 +0500
Date: Mon, 12 Jul 1999 11:40:33 -0500 (CDT) DBSHUT hangs
Date: Tue, 13 Jul 1999 10:11:03 -0400
Date: Tue, 13 Jul 1999 15:39:04 +0100
Date: Tue, 13 Jul 1999 19:01:52 +0400
Date: Tue, 13 Jul 1999 07:58:26 -0700 (PDT)
Date: Tue, 13 Jul 1999 17:38:12 +0200
Date: Tue, 13 Jul 1999 17:02:52 +0100
Date: Tue, 13 Jul 1999 12:50:34 -0400
Date: Tue, 13 Jul 1999 18:55:14 +0200
Date: Tue, 13 Jul 1999 09:50:58 -0700 Remove data by using UNIX command...
Date: Fri, 16 Jul 1999 10:46:07 -0400
Date: Fri, 16 Jul 1999 17:39:09 +0200
Date: Sat, 17 Jul 1999 14:04:36 MYT-8
Date: Sat, 17 Jul 1999 09:07:16 -0400
Date: Sun, 18 Jul 1999 11:21:12 -0400 (EDT) How to find files recently changed
Date: Wed, 21 Jul 1999 15:26:16 GMT
Date: Wed, 21 Jul 1999 11:33:30 -0400
Date: Wed, 21 Jul 1999 23:33:09 +0500 Host program - Unix Shell - Parameter passing to
Date: Wed, 11 Aug 1999 09:09:37 -0700 (PDT)
Date: Wed, 11 Aug 1999 11:44:50 -0500
Date: Wed, 11 Aug 1999 12:02:26 -0500
Date: Wed, 11 Aug 1999 10:00:14 -0700 (PDT)
Date: Wed, 11 Aug 1999 15:13:01 -0400
Date: Wed, 11 Aug 1999 15:33:06 PDT
Date: Wed, 11 Aug 1999 19:16:08 -0700 (PDT)
Date: Thu, 12 Aug 1999 07:55:01 -0700 (PDT) Copying files based on size
Date: Fri, 13 Aug 1999 16:39:43 +0800 (SGT)
Date: Fri, 13 Aug 1999 08:39:26 -0400
Date: Fri, 13 Aug 1999 09:13:49 -0400 (EDT)
Date: Fri, 13 Aug 1999 06:21:57 -0700 (PDT)
Date: Fri, 13 Aug 1999 11:57:36 -0400 Send Attachments and TXT Messages in a single email
Date: Tue, 27 Jul 1999 16:01:36 -0400
Date: Fri, 13 Aug 1999 18:09:52 +0100
Date: Fri, 13 Aug 1999 14:24:19 -0400 Backup - tar error
Date: Sat, 14 Aug 1999 13:31:26 -0700
Date: Sat, 14 Aug 1999 14:20:43 -0700
From: "Reddy, Vishnu" VReddy@prcnet.com
Subject: RE: some unix's scripts??
Hope this command helps you.
cat
From: S V MANSATA kunal@blr.vsnl.net.in
To: oraapps-dba@cpa.qc.ca
Subject: exit command of unix
hello all
can some one tell me what is the meaning of exit 0, exit 1, etc with
reference to unix
thanks
promeet s mansata
From: "James J. Morrow" jmorrow@csac.com
To: oraapps-dba@cpa.qc.ca
Cc: jmorrow@csac.com
Subject: Re: exit command of unix
The "exit 0" or "exit 1" is a means of returning a "status code" to the
calling process (or shell) that is generally used to indicate the relative
success or failure of the routine.
Typically, (In a non-MicroSoft world at least...), a "status code" or a
"return code" of "0" signifies a successful completion.
You could also use higher numbers to account for multiple potential "failures".
For example... (in pseudo-code...)
if today != tuesday ... exit 2
if file does not exist ... exit 1
if file does exist ... exit 0
Then, the calling program could "evaluate" that return code and execute
some sort of error-handling routine...
You might consider looking at the "man page" for the exit command on your
unix system...
type: man exit
-- James
Note: Some of the behavior I've described above may vary with the use
of different shells...
From: jcocke@csc.com
To: oraapps-dba@cpa.qc.ca
Subject: DBSHUT Hangs
Can anyone send me a script that will kill all defunct Unix processes? I am
running MTS and my dbshut script hangs.
Thanks in advance...John
From: Philip West Philip.West@exco.co.uk
Subject: RE: DBSHUT Hangs
where does it hang?
why not shutdown abort / startup normal / shutdown normal ?
Best Regards
Phil West - Oracle Financials DBA
Telephone: 44 171 9509385
E-mail: philip.west@exco.co.uk
From: mzaveri@eppco.co.ae
To: oraapps-dba@cpa.qc.ca
Subject: Re: DBSHUT Hangs
BTW which version are you using?
Ideally, we shutdown immediate, startup in restrict mode and execute the
shutdown normal
'immeidate' kills all the connections including on-going transaction and
sql*net clients as well.
Ours is Oracle 8.0.4.2 and above works.
From: Ted Sasscer tsasscer@yahoo.com
Subject: Re: DBSHUT Hangs
One line:
ps -ef | grep 'defunct' | grep -v grep | awk '{print $2}' | xargs kill
(1) You can only kill processes you own, unless you are root.
(2) Do not kill your own search-and-destroy process (grep -v)
Ted
###
From: "Worthington, S." S.Worthington@ahpg.com
Subject: RE: DBSHUT Hangs
ps -ef | grep defunct | grep -v grep | awk '{print "kill -2 " $2}'
Two reasons not to run shutdown abort are that you switch logfiles and lose
all cached sequence values.
HTH, Stu
stuartw@email.com
From: Philip West Philip.West@exco.co.uk
Subject: RE: DBSHUT Hangs
1. What's the problem with switching log files?
2. You cannot guarantee consistent sequencing anyway. If your application
requires consistent sequences you must find another way to implement them.
3. If you have a critical backup or maintenance window you must be
prepared to use shutdown abort to prevent a potentially long wait whilst
jobs are rolled back. The defered rollback feature of newer versions of
Oracle make this even more efficacious to improved use of available
downtime windows.
From: "Shreter, Hilary" ShreterH@orau.gov
Subject: RE: DBSHUT Hangs
I run "alter system switch logfile" [hope that's right without looking it
up] just before the shutdown abort. Don't know if that helps with the
cached values.
From: "Worthington, S." S.Worthington@ahpg.com
Subject: RE: DBSHUT Hangs
1) Switching logfiles isn't a big issue, but if things go wrong:
a) it does reduce the buffer you have before the database hangs, should your
archive dest fill
b) it makes it slightly more likely that you'll have to go past your online
logfiles if you need to recover.
2) You're right, you can't guarantee consistent sequences especially for
data entry, but you can get them most of the time if you pin the important
sequences. Most sites seem to get upset when they see too many gaps in
their sequences.
3) For important scheduled backups, I would either go with hot backups, or
shutdown immediate, then abort after say 5 minutes if the database isn't
already down. I would never start off with an abort. I know some sites use
shutdown abort as standard, but I think that's normally because it's easier
to script, and I just wanted to point out that it does have its drawbacks.
> why not shutdown abort / startup normal / shutdown normal ?
I think this would take at least as long as a shutdown immediate, since the
deferred rollback doesn't help. Also, you would use startup restrict to
stop anyone from logging in.
> I run "alter system switch logfile" [hope that's right without looking it
up] just before the shutdown abort. Don't know if that helps with the
cached values.
I don't think that would help with the sequence values.
my 2c worth, Stu
stuartw@email.com
From: "Binh Pham" Binh.Pham@jpl.nasa.gov
Subject: Re: DBSHUT Hangs
If it was trying to rollback active trans when you were shutting it down,
then shutting down abort, starting it up again and then shutdown normal, you
still must wait for the trans to be rollback again. I would wait for it to
go down gracefully.
Unless, you just want to shut it down and then start it backup and leave it
up, then shutdown abort, start it up again should work.
From: "Reddy, Rajasekhar" Rajasekhar.Reddy@fmr.com
Subject: Remove data by using UNIX command...
Hi,
Could some one tell me how to remove the data by using UNIX command?
For ex I have a unix script that will spool the data into a spool
file and
I have to remove the first 10 lines of the file.
Can I use egrep to eliminate the data from line 1 to Line 10 and
print the rest?
Thanks in advance....
-Raj
From: sebastien.herpin@clf-dexia.com
Subject: =?iso-8859-1?Q?R=E9f._:_Remove_data_by_using_UNIX_command...
To remove the first 10 lines of a file:
just type awk 'NR 10' file
or tail -n +10 file
From: philip@aleytys.pc.my
To: "Reddy, Rajasekhar" Rajasekhar.Reddy@fmr.com, oraapps-l@cpa.qc.ca
Subject: Re: Remove data by using UNIX command...
There are two standard unix commands that you can use:
"head" and "tail". Check out the man pages for the syntax.
Philip
From: ssv virdi@interlog.com
Subject: RE: Remove data by using UNIX command...
At the end of the unix script(?), after generating the output file
Put this command
sed '1,10d' output_file required output file.
Sudershan virdi
From: "A. Dell'elce" neaya@yahoo.com mailto:neaya@yahoo.com
To: Rajasekhar.Reddy@fmr.com mailto:Rajasekhar.Reddy@fmr.com
Subject: RE: Remove data by using UNIX command...
Try the following:
--- remove 10lines script ---
#!/bin/ksh
FILE=$1
[ ! -f "$FILE" ] && exit 1
LINECOUNT=$(wc -l $FILE )
let LINECOUNT_N=$(( $LINECOUNT - 10 ))
tail -$LINECOUNT_N $FILE ${FILE}.NEW
--- end of file ---
You can replace with $2 ....
Tell me if it works... different unixes and different
Korn-shells behave in different ways (and accept different
arguments)!
Bye
From: "manu b" manu024@hotmail.com
Subject: a Unix question..
Hi All,
A pretty trivial question for unix Gurus.. I want to know a way to
find out all the files which have been chnaged in last few days like file
updated yesterday. On Hp-UX10.2
thanks in advance..
From: "Jacques, Pascale (SSC)" pjacques@ssc.knightridder.com
Subject: RE: a Unix question..
find / -mtime +2 -print
From: S V MANSATA kunal@blr.vsnl.net.in
Subject: Re: a Unix question..
hi there manu
i think one of the following would help u
find .-atime 7 -print
accessed files in current dir accessed 7 days ago
find / -atime +7 -print - not been accessed for more than 7 days
find . -mtime +7 -print - modified more than 7 days ago
find . -ctime +7 -print - files whose status has changed more than 7 days ago
hope this helps
promeet s mansata
From: Rajesh TL priyarajesh@yahoo.com
Subject: HOST PROGRAMS (UNIX SHELLS)-URGENT
Hi All
I have a unix script that takes in parameters
I have registered the script as a host type Concurrent
program .
When I try running the concr. pgm,the same errors
out since I am referring to the parameter that I pass
from Apps as $1 thro $n
I understand Apps puts it's own parameter on top
of the user defined ones and so $1 gets me the
parameter that Apps has poped up rather than mine.
I guess this problem is familiar.
Please throw some light
Thanks
Rajesh
From: "Kanakam, Venkat (c)" vkanakam@Carlson.com
Subject: RE: HOST PROGRAMS (UNIX SHELLS)-URGENT
Did you register the parameters in the conc. program in the order in which
you are expecting the UNIX Shell prog. receives the values?
HTH
Venkat Kanakam
Consultant
CIBER, Inc.
From: "Vikram Reddy" Vikram_Reddy@intervoice.com
To: oraapps-l@cpa.qc.ca, priyarajesh@yahoo.com
Subject: Re: HOST PROGRAMS (UNIX SHELLS)-URGENT
Rajesh,
Apps appends user parameters to the default apps parameters in $1.
You have to parse $1 to get the user parameters.
Cheers
Vikram.
From: Andy Schindler aschindl@yahoo.com
Subject: Re: HOST PROGRAMS (UNIX SHELLS)-URGENT
The concurrent manager adds 8 parameters to the host
program. You need to parse these out (they can be
very useful) and start with parameter 9 for your
custom parameters.
Andy Schindler
NRC, Inc.
From: "Jhaveri, Prashant" Prashant.Jhaveri@Olsten.com
Subject: RE: HOST PROGRAMS (UNIX SHELLS)-URGENT
Rajesh,
Oracle appends the program parameters after it's own parameters. Apps has
got 8 parameters of it's own but they all gets passed as $1. If you've two
parameters in your shell script, then they are appended at the end. You can
use following cut statements to get your parameters.
PARAM1=`echo $1 | /bin/cut -f8 -d'"'`
export PARAM1
PARAM2=`echo $1 | /bin/cut -f9 -d'"'`
export PARAM2
and so on ...
This way you can get your parameter values. Also, please note that you need
to register these parameters into the concurrent program too.
- Prashant Jhaveri
(516)-391-4156 (W)
From: "Alok Chadda" alok_chadda@excite.com
Cc: priyarajesh@yahoo.com
Subject: RE:HOST PROGRAMS (UNIX SHELLS)-URGENT
Rajesh -
Please check whether following details help you in anyway:
Below are information to register shell scripts as host programs in Oracle
Applications.
1. Create a shell script ( say example) and move to the appropriate BIN
directory in Oracle Application.
2. The parameters in the shell scripts should start with $5 , $6 Onwards.
3. Rename the shell script to *.prog ( example.prog).
4. Change Permissions to 755 for the *.prog file.
5. Create Link to the shell Script ( ln -s
$FND_TOP/bin/fndcpesrexample.prog).
6. Step 5 Creates example file. Register this executable in the application
as a host executable (Using System Administratorprivilege ).
Please Note : The first parameter in the concurrent program is passed as
the Fifth parameter in the shell scripts
since the first four parameters are allocated to userid,request_id .. etc.
If for some reason the Concurrent program fails then check to see the
privileges of the shell script ( example.prog) . It might have to be
registered using applmgr logon .
HTH
Alok
From: Kevin Gillins kgillins@yahoo.com
Subject: Re: HOST PROGRAMS (UNIX SHELLS)-URGENT
Lets see here.
First, the replies about parsing the paramters is not necessary if you
are performing the tasks properly in the system for registration.
Oracle will product parsed values in the first 4 parameters $1 - $4.
All parameters you add when registering will start in $5 and continue
through to $9 before you need to use the UNIX shift feature.
Now, where the problem is for the replies that say you have to parse
the $1 parameter need to refer to the documentation. When registering
a Host (UNIX SHELL) you need to create your shell script with the exact
name pattern of scriptname.prog. The ".prog" is the key part of this
exercise. Make sure the file has proper execute permissions. Now,
create a symbolic link in your custom code directory. The link is
created using the ln -s command like the following.
ln -s $FND_TOP/$APPLBIN/fndcpesr scriptname. The link will not
contain the ".prog". Now when you execute the concurrent program you
will receive the first 4 parameters as the following.
$1 = schema/password (apps/fnd)
$2 = number of parameters passed from request
$3 = Requestor user name
$4 = Concurrent request number
For further details and documentation on this refer to my web page
where I have made available white papers presented at OAUG.
www.geocities.com/SiliconValley/4946
Kevin
From: Andy Schindler aschindl@yahoo.com
Subject: Re: HOST PROGRAMS (UNIX SHELLS)-URGENT
Kevin, Thank you for clarifing a difficult section of
Oracle AOL reference manuals.
I choose to skip Oracle's cumbersome link processes
and manually parse out parameter 1 inside my host
scripts as I gain access to a number of other useful
parameters.
The raw parameters passed by the concurrent manager
are:
1: Concurrent Program Short Name
2: Request ID
3: Logon Name (APPS/FND)
4: User ID
5: User Name
6: Printer
7: Save Output (Y/N)
8: Number of copies
9 and beyond: User defined parameters
As I need access to the printer information in a large
number of my custom scripts, this method is better for
me.
Andy Schindler
NRC, Inc
From: Rudy Wahab rudy@fcm.ed.fujitsu.co.jp
Subject: Copying files based on size
HI,
Does any unix guru out there know the unix command to copy a files
based on file size.
I have 2 situations here:
I want to copy any files with *.TXT with file size > 0 only and
copy any files with *.TXT with file size = 0
Any help will be appreciated. Thanks
regards,
Rudy Wahab Phone: 07-454 2111 ext 211/313/218
System Analyst email: rudy@fcm.ed.fujitsu.co.jp
Information Services Section
Fujitsu Components (M) Sdn. Bhd.
Batu Pahat, Johor.
Malaysia
From: "Steve Hersh" hershs@worldnet.att.net
Subject: RE: Copying files based on size
*.txt with file size 0:
for file in `find . -name '*.TXT' ! -size 0 -print`
do
cp $file $file.new
done
*.txt with file size = 0:
for file in `find . -name '*.TXT' -size 0 -print`
do
cp $file $file.new
done
* Steve Hersh
* Technology Solutions
From: Madhu Sudan Dada dada@csee.usf.edu
Subject: Re: Copying files based on size
Post to deja news and that will be the right forum. You can do through
ksh script I used to do 3 years back.
From: Kevin Gillins kgillins@yahoo.com
Subject: Re: Copying files based on size
There usually is more than one way to do things. Here is how I would
do it.
First I would make a small shell script that performs the move command.
mv $1 /newpath
Now I would use the following command to locate files greater than the
target size.
cd /desired_path; find . -type f -name "*.txt" -size +333c -exec
script {} \;
The -type f is to find normal text type files.
The -name "*.txt" is to find pattern matched files.
The -size +333c will locate all files with size greater than 333 bytes.
The -exec shell {} \; will execute command passing file name as
parameter.
To find size of zero just replace the +333c with 0c.
Also, the director to move the files into should not be a subdirectory
of the one where the find command will traverse into. The find command
will decend all subdirectories and perform the instructions.
Kevin
From: "Sharma, Seema (CAP, GEFA Contractor)" Seema.Sharma@gecapital.com
To: "'oraapps-l@cpa.qc.ca'" oraapps-l@cpa.qc.ca
Subject: RE: Copying files based on size
OR Another way of finding file size :
for fl_name in `cat *.txt`
do
if [ -s $fl_name ] # This chk. will give you file size 0
then
copy $fl_name to another_file
else
ignore it
fi
done
Seema
From: "Phillips, Brant" phillib@mps.bellhowell.com
Subject: Sending EMAIL Attachments & TEXT Messages in a single email
Does anyone have any suggestions for sending information in the body of an
email message using as well as sending an attachment. I can do one or the
other but not both. I've been struggling with a way to do both. If you
have any suggestions, please let me know.
Sends the attachment only:
uuencode /home/phillib/temp.txt temp.txt | mailx -ms "This is a test"
Brant.Phillips@mmt.bellhowell.com contact.txt
Sends the contact text only:
mailx -ms "This is a test" Brant.Phillips@mmt.bellhowell.com
/home/phillib/contact.txt
This does not work:
uuencode /home/phillib/temp.txt temp.txt | mailx -ms "This is a test"
Brant.Phillips@mmt.bellhowell.com contact.txt
It sends the contact text but will not attach the temp.txt file. Please let
me know if anyone has any ideas.
Thanks,
Brant
Brant Phillips
Sr. Programmer Analyst
Bell & Howell Mail & Messaging Technologies
4401 Silicon Drive
Durham NC 27709
E-Mail:Brant.Phillips@mmt.bellhowell.com
From: James.Walker@blackwell.co.uk
Subject: RE: Sending EMAIL Attachments & TEXT Messages in a single email
Brant ---
Did you see the posting on OraApps-DBA from Timothy J. Brewer dated 21 May
1999 15:57?
I have copied it below your email just in case. I have tried it myself and
it works for me.
(Please see below)
Regards
-James-
COPY
----------
From: TB Solutions, Inc.[SMTP:tbrewer@tbsolns.com]
Reply To: oraapps-dba@cpa.qc.ca
Sent: 21 May 1999 15:57
To: Multiple recipients of list
Subject: Solution: Is there a way to send file as attachment through
the mailx
SOLUTION:
Sorry for the delay in responding, but your answer is.......
(cat body_file.txt ; uuencode attach1.pdf attach2.pdf) | mailx -s
'Subject
line of msg' support@tbsolns.com
body_file.txt - file contents will become the body of the e-mail
attach1.pdf - input source on UNIX that will be attached.
attach2.pdf - name of the attachment that is attached to the e-mail
(when you select the little paperclip)
-s - of course, the subject line of email
support@tbsolns.com - simply an e-mail address that this e-mail is
being sent to ...
I have used this for ascii, pdf and postscript but you should be able to
use for most all formats.
Later,
Timothy J. Brewer
Senior Oracle Consultant
TB Solutions, Inc.
/COPY
From: "Phillips, Brant" phillib@mps.bellhowell.com
To: "'OAUG Distributions'" oraapps-l@cpa.qc.ca
Subject: FW: Sending EMAIL Attachments & TEXT Messages in a single email
Thank you very much for forwarding the solution to my problem. It works
great!!!
Brant Phillips
Sr. Programmer Analyst
Bell & Howell Mail & Messaging Technologies
4401 Silicon Drive
Durham NC 27709
E-Mail:Brant.Phillips@mmt.bellhowell.com
Voice Mailbox #4039
From: Karen Blackwell KBlackwell@rockshox.com
Subject: UNIX: Backup question
Hello UNIX Guru's
or anyone else who can help out ....
I am attempting to backup my primary root directories (I.E.: /var, /usr,
/export, /bin, etc...)
On one of my systems, I am having a problem as I keep getting an error:
tar: write error: unexpected EOF
I am able to perform the same tar on two systems, but not the third. I have
tried a new tape, I have cleaned the tape drive. For the life of me, I
cannot figure what is up with this.
Any suggestions?
OR -- If someone has a script (tar) which is successful for you, I would
appreciate you sharing.
Thanks to all.
Karen Blackwell
DBA/System Administrator
RockShox, Inc.
408.570-4912 phone
408.435.7468 fax
From: Karen Blackwell KBlackwell@rockshox.com
To: "'oraapps-l@cpa.qc.ca'" oraapps-l@cpa.qc.ca
Subject: RE: UNIX: Backup question
I have resolved this issue. (You need to name your devide properly or it
takes up all your disk space. oops)
Thank you for listening.