ORACLE APPLICATIONS ARCHIVES

Topicwise collection of
Postings on Mail Lists
ON
UNIX SCRIPTS



Combining 2 files

Date: Fri, 23 Jul 1999 14:24:11 GMT
From: "manu b" manu024@hotmail.com
To: oraapps-dba@cpa.qc.ca
Subject: Unix gurus.. pls help

Hi All,
A unix question
File1 :
1
2
3
File2 :
a
b
c
I want a output in a file like the following

1 a
2 b
3 c

in Unix environment.

Any help will be greatly appreciated..
thanks


Date: Fri, 23 Jul 1999 09:30:35 -0500
From: Michael S Barone Michael.S.Barone@Cummins.com
To: oraapps-dba@cpa.qc.ca
Subject: Re: Unix gurus.. pls help

Manu:

Piece of cake ... try the unix command "paste"
... paste file1 file2 > file3

File3 will contain your results.


Date: Fri, 23 Jul 1999 21:15:58 PDT
From: "shankar govindan" shankargovindan@hotmail.com
To: oraapps-dba@cpa.qc.ca
Subject: Re: Unix gurus.. pls help

Does'nt CAT file1 file1 > file3
do the same job like paste.

shankar


Date: Tue, 27 Jul 1999 10:11:51 +1000
From: Grant Allen grant@towersoft.com.au
Subject: RE: Unix gurus.. pls help

No, cat appends to the end of the file, it doesn't interleave the contents.

Ciao
Fuzzy


Date: Mon, 26 Jul 1999 20:56:50 -0500
From: Michael S Barone Michael.S.Barone@Cummins.com
To: oraapps-dba@cpa.qc.ca
Subject: Re: Unix gurus.. pls help

shankar:

UNIX "cat" vs "paste"

"cat" ... catalogs the two or more files vertically ... appending
file1 then file2 ...

1 file1
2
3
4
a file2
b
c
d

"paste" ... on the other hand horizontally appends the rows
from file1 with the corresponding rows in file2:

file1 file2
1 a
2 b
3 c
4 d



Printing 2 copies for a request

Date: Fri, 23 Jul 1999 15:29:00 +0100
From: "Singh, Gagandeep " Gagandeep.Singh@scottishpower.plc.uk
To: oraapps-dba@cpa.qc.ca
Subject: UNIX Printing Problem

Hi All,

I am printing to a printer setup correctly(apparently) in UNIX. However, it prints off 2 copies for a single request. Are there any environment variables which need to be setup in Unix or that i can check in UNIX. Also, physical settings on the printer for number of copies seem OK to me.It prints one copy for non Unix applications.

Any suggestions would be appreciated.

Thanks
Gagan


Date: Fri, 23 Jul 1999 10:59:25 -0400 (EDT)
From: Kevin Gillins kgillins@yahoo.com
To: oraapps-dba@cpa.qc.ca
Subject: Re: UNIX Printing Problem

Check your profile option %Copies% at all levels in the application. There may be multiple copies being requested at an application or responsibility level.

Try the same request against a different print queue to verify if it is just one printer or if it is for the specific user.

Kevin
===
Kevin Gillins
Oracle Applications Consulting
WEB PAGE <>


Date: Fri, 23 Jul 1999 10:40:40 -0500
From: Michael S Barone Michael.S.Barone@Cummins.com
To: oraapps-dba@cpa.qc.ca
Subject: Re: UNIX Printing Problem

Gagan:

You can FORCE a number-of-print-copies by changing/modifying your UNIX "PRT" filename in the $FND_TOP/srw/?????.prt file. You can determine which UNIX PRT file your report is using via:

System Admin (Responsibility)
Navigate
Install
Printer
Driver

Note your "SRW Driver" ... usually HPL (Landscape HP) HPW (LandWide HP) and HPP (Portrait HP). These UNIX Files can be found in the $FND_TOP/srw directory with a "prt" extension.

For Example: our HPP.prt file contains the following:
before report "^[&l2X"
between pages control(L) "^[&l2X"

Where the "2X" control-sequence forces 2-Copies to be printed.


Date: Fri, 23 Jul 1999 16:22:42 -0400
From: "Timothy Brewer" tbrewer@tbsolns.com
Subject: Re: UNIX Printing Problem

(I presume that you are selecting 1 copy in the standard report submission screen)

Continue to isolate this problem.

1. Try a different username
2. Try a different printer TYPE, if possible.
3. Finally, ensure that the lp command in the printer set-up is actually using PROFILES.COPIES instead of being hardcoded to 2 (someone possibly changed to lp -d%PROFILES.PRINTER% -n2 for testing......).

Please update the list to the results of the above and maybe we can help further.

HTH,
Timothy J. Brewer
Senior Oracle Consultant
TB Solutions, Inc.



Script to extract employee information

Date: Mon, 26 Jul 1999 22:31:48 GMT
From: "manu b" manu024@hotmail.com
To: oraapps-dba@cpa.qc.ca
Subject: some advanced shell scripts : Real urgent

Hi Unix gurus,
I am back again..I have a file for employee records. Each employee has 4 lines in it. The first line for each employee record contains the employee number. In the second line there may or may not be a benefit plan for that employee.

I am tring to do extract info for each employee from 2nd line for the benfit plan with use of 'grep' and 'cut'. I do something like this

--For the employee number
cat file|grep -i emp_num|cut -c10-15 >e_num
--For the employee benefit
cat file|grep -i plan_nm|cut -c10-15 >e_plan

Then I do paste
paste e_num e_plan > new_file

The problem in the above is that it will not have all the employees listed with their benefit values as some of them may not have the plans. I want to print "0" in front of the empl num when he does not have the benefit plan. Will anyone suggest some alternative to this requirement..

Appreciate an early repsonse from anyone..
thanks


Date: Tue, 27 Jul 1999 09:30:17 +0100
From: Philip West Philip.West@exco.co.uk
To: oraapps-dba@cpa.qc.ca
Subject: RE: some advanced shell scripts : Real urgent

Firstly, why not code sql to put 'no-plan' or whatever into flat file in the first place.

Otherwise: If the format of the line is determinable you could use sed.

example file here
...........................
plan_nm 234
plan_nm 234
plan_nm
plan_nm 888
..........................
*note that here we have the string 'plan_nm ' including a space as minimum followed by optional employee number

sed "s/plan_nm $/0/" file > e_plan

your new_file will then hold something like

emp1 234
emp2 234
emp3 0
emp4 888

Best Regards
Phil West - Oracle Financials DBA
Telephone: 44 171 9509385
E-mail: philip.west@exco.co.uk



Combining Files - script for

Date: Tue, 27 Jul 1999 11:45:40 -0500
From: Bharat Patel bpatel@DOMINOAMJET.com
Subject: RE: Help : Unix - Shell Scripts

regarding the unix play around. I have following requirement.
1. I am creating a file by using ls -lt|grep 'xxx' > file1.txt
2. cut -c n-n,n-n file1.txt > file2.txt
3. vi and replace the 'xxx' from file2 with 'yyy'
4. run this file to do the work(delete some temp files)

I am looking to create my file2.txt with replace character in a one command.

how can I do that?

Bharat Patel
D.B.A.
bpatel@dominoamjet.com
847-244-2501 ex 1249


Date: Tue, 27 Jul 1999 15:49:47 -0400
From: cwroblewski@orioncapital.com
To: oraapps-dba@cpa.qc.ca
Subject: RE: Help : Unix - Shell Scripts

If I am understanding you correctly do the following

- vi file2
- hit shift :
- type the following 1,$s/xxx/yyy/g

This is a sed command that will do a global replace.


Date: Tue, 27 Jul 1999 16:00:35 -0500
From: Bharat Patel bpatel@DOMINOAMJET.com
To: "'oraapps-dba@cpa.qc.ca'"
Subject: RE: Help : Unix - Shell Scripts

No, I want to use all in one command line I don't want to use VI editor at all. I got the reply from other forum users. only thing I am playing around is to combine ll|grep command and others.

thanks.
Bharat Patel
D.B.A.
bpatel@dominoamjet.com
847-244-2501 ex 1249


Date: Wed, 28 Jul 1999 10:00:23 +0400
From: mzaveri@eppco.co.ae
To: oraapps-dba@cpa.qc.ca
Subject: RE: Help : Unix - Shell Scripts

Dear bharat,
You can just use the same command in
sed too.
sed 's/xxx/yyy/g' src > out
Hope, I understood it ok.
Also you can use -n flag, to just print those replaced lines and stop
non-replaced lines to print..

regds


Date: Wed, 28 Jul 1999 07:16:30 -0500
From: Bharat Patel bpatel@DOMINOAMJET.com
To: "'oraapps-dba@cpa.qc.ca'"
Subject: RE: Help : Unix - Shell Scripts

If I am not wrong ur name is Mehul Zaveri, Right?. Thanks Mehul and all those who help me out.I got the solutions from Denny. I hope I will get the same kind of help in future.

Bharat Patel
D.B.A.
bpatel@dominoamjet.com
847-244-2501 ex 1249


Date: Wed, 28 Jul 1999 10:49:05 -0500
From: Gopi_Vakulabharanam@kellwood.com
To: oraapps-dba@cpa.qc.ca
Subject: RE: Help : Unix - Shell Scripts

If you are trying to remove some selective files try this:
ls -lt | grep xxx | awk '{print $9}' | xargs rm -f $1
HTH


Date: Thu, 29 Jul 1999 10:09:15 +0400
From: mzaveri@eppco.co.ae
To: oraapps-dba@cpa.qc.ca
Subject: RE: Help : Unix - Shell Scripts

Just to add on here,
Is it not risky to grep on ls -lt? , it may grep xxx even in other fields of ls -lt. isn't? I would advice to exchange grep and awk commands. No need, If you are confident that in future your string (say 'xxx') will not be a part of rest of the fields. But this assumption may put you in big trouble, because you are using it with rm. Just to highlight the danger point.


Date: Thu, 29 Jul 1999 11:44:34 +0530
From: "Akbar Ibrahim" akbari@wipsys.soft.net
To: oraapps-dba@cpa.qc.ca
Subject: Re: Help : Unix - Shell Scripts

Why not use the find command to find and delete the files. This could be one good way to do it. grep could be dangerous as has already been poinged out.

here's the grep command (to find all files with the extension tmp)

find /mydirectory -name "*.tmp" -exec rm {} \;

Note 1 : The find command descend down the specified directory and performs the exec action on all the files found in all the subdirectories and their subdirectories.

Note 2 : The *.tmp has to be quoted to prevent the shell from interpreting it.

Note 3 : The find command has other options such as find files which have not been modified for over n days or which have been modified within n days, which are owned by a particular user or group etc.

Hope this is useful
Akbar



Unix Issues - Picking selective files

From: Singh, Gagandeep [mailto:Gagandeep.Singh@scottishpower.plc.uk]
Sent: Wednesday, March 31, 1999 9:58 AM
Subject: Unix Question

Hi Unix Gurus!
I need to write a unix script ...which picks up all file beginning with 9 and extn 'lst' and rename their file extension to 'txt'. eg a file 9xyz.lst ---> 9xyz.txt

for i in `ls 9*.lst`
do
.......
done
Any ideas would be appreciated. Thanks GD


Date: Wed, 31 Mar 1999 11:14:12 -0500
From: "Ellis, Rob"
Subject: RE: Unix Question

This ought to work.
for i in `ls 9*.lst`
do
basename=`echo $i | cut -d'.' -f1`
mv ${basename}.lst ${basename}.txt
done


# Useful shell function for bailing out
err_exit() {
echo $* &2
exit 1
}
# Make sure that there are three arguments
[ $# -eq 3 ] || err_exit "usage: $0 directory old_ext new_ext"
start_dir$1
old_ext$2
new_ext$3

# Change to the specified directory
cd $start_dir || err_exit "Cannot change directories to $start_dir"
# Use find to recurse through the directories
find . -type f -name \*$old_ext -print |
while read pathname
do
dir`dirname $pathname`
file`basename $pathname`
newname$dir/${file%$old_ext}$new_ext
mv $pathname $newname
done
exit $?
---------------------------------------------------------------------------
Philip Chee: Tasek Corporation Bhd, P.O.Box 254, 30908 Ipoh, MALAYSIA
e-mail: philip@aleytys.pc.my Voice:+60-5-545-1011 Fax:+60-5-547-3932


Date: Thu, 1 Apr 1999 11:12:27 -0600 (CST)
From: "James J. Morrow" jmorrow@csac.com
Cc: jmorrow@csac.com
Subject: Re: Unix Question

You can also do this as a simple in-line script (/bin/ksh)
ls -1 9*.lst |while read LINE
do
export BASE`basename ${LINE}|cut -f1 -d"."`
export DIR`dirname ${LINE}`
mv ${LINE} ${DIR}/${BASE}.txt
done
-- James
----------------------------------------------------------------------------
James J. Morrow E-Mail: jmorrow@csac.com
Systems Consultant USSnail: 6380 LBJ Freeway #181
Computer Systems Authority Dallas, Texas 75240
Dallas, Texas (972) 960-0180 x244

Modify UNIX Reports with NT

From: pkandra@civicdevelopment.com [SMTP:pkandra@civicdevelopment.com]
Sent: Wednesday, April 07, 1999 1:42 PM
Subject: RPT: How to modify UNIX reports with NT

Can anyone please tell me all of the necessary steps to modify a UNIX reports 2.5 file with the NT version of reports 2.5 ? I get the file from Unix, open it with NT and I always get a 'There exist uncompiled program unit(s)'. I know I'm missing a step, I just don't know what.

Thanks in advance Peter Kandra pkandra@civicdevelopment.com


Date: Wed, 7 Apr 1999 15:09:06 -0400
From: "Vallapareddy, Krishna" kvallapareddy@noblestar.com
Subject: RE: How to modify UNIX reports with NT

This problem usually arises when there are any program units like libraries attached to the report. The rdf file stores a link (path) to the library files which are used in the report. When you ftp the rdf file from unix to NT ,you are not able to make a connection to the library files still on the Unix system and so the program units cannot be retreived as you open the report on the NT side. What I would suggest is that you open the reports using any X-Windows software on the unix side. You could use the command ar25desb at the $ prompt. If you are uncomfortable with working on X-Windows, then just make whatever modifications you need to the report on the NT side without bothering about the error messages and then transfer the file back to the Unix system. Once on the Unix box, you could always open the original report which you copied and also open your modified copy(with X-Windows), then you can simply copy all the program units from the original to the custom report by drag and drop. You should be able to compile this way.

Well atleast it has worked for a lot of us. Hope this helps. Good Luck, Krishna Vallapareddy Oracle Financials Consultant Noblestar Systems Corporation (703) 464-4000 ext 2508 or (800) 470-4668 ext 2508


UX script to remove files in APPL_TOP

Rudy Wahab rudy@fcm.ed.fujitsu.co.jp wrote:

Hi, Does anyone have a unix scripts to remove all files in a particular directory that are 10 days old?

I want to remove all files that are 10 days and above old in APPL_TOP/common/log

Please help ..thanks in advance

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 *************************************************************************


Date: 4 Apr 99 18:42:02 EDT
From: Dinesh Chandra dchandra@usa.net
Subject: Re: [removing files in APPL_TOP/common]

Hi Rudy, Try following
find . -name "*" -mtime +10|while read a; do rm $a;done

Thanks Dinesh Chandra


Greg Hoover wrote:

Rudy,
You are attempting to remove files from the Concurrent Manager directory which can be done programmatically using an existing AOL program.

Log into the Oracle Application as the System Administrator. Go into the Concurrent Requests form and submit a request for "Purge Concurrent Request and/or Manager Data". When it asks for the parameters, enter "ALL" for the entity, "AGE" for the mode, and "10" for the mode value. This will force the job to purge all data related to any concurrent program from the system and from the concurrent process database tables.

Also, you will want to read the portions of the Oracle manuals that deal with Managing the Concurrent Manager (sorry I don't recall what manual it is found in).

Greg Hoover System Engineer American Trans Air


Date: Mon, 05 Apr 1999 10:42:42 -0500
From: Dan Olson dolson@dacotah.com
Subject: Re: removing files in APPL_TOP/common

I schedule the Purge request to delete once a week after a appl_top backup. But I do notice that sometimes CM purge will miss some files, so a do a manual Unix rm, once a month.



FTP and File Management

From: "Bubba New" bubba_new@hotmail.com
Subject: Shell Script for FTP and file management.
Date: Thu, 8 Apr 1999 18:22:50 -0400 (EDT)

Hi Oracle Gurus:

I would appreciate your thoughts on the following task I am trying to achieve:

I am trying to write a shell script to automate ftp process from our server to another (remote) server. What I am trying to do is that once a file has been moved to the OUT directory, my shell script should add a date and time stamp to it, FTP it to the remote server and then move it to the ARCHIVE directory. Similarly on the IN directory, I would like to move a file to another directory, depending on the name of the file (PO or INV subdirectory), rename it (give it a fixed name depending on the 'Infile' name in SQL*Loader script), and then give it a date and time stamp before moving it to an ARCHIVE directory.

First of all, please let me know if it makes any sense at all. Your comments, piece of advice, sample code, etc. are very welcome.
Thanks in advance. Mohamed


Date: Fri, 09 Apr 1999 05:12:39 PDT
From: "stephen bryant" sbryant@hotmail.com
Subject: Re: Shell Script for FTP and file management.

I have used korn shell scripts for the following FTP process:

ftp -n IP ADDRESS endFTP
user USER_ID PASSWORD
ascii
put LOCAL DIRECTORY FILE NAME REMOTE DIRECTORY FILE NAME
endFTP

Before and After the FTP process, you can use cp (copy) and/or mv (rename) commands with date and time stamps.

Any questions, please email me. Steve



Monitor Printer queue at Unix level

Date: Wed, 1 Sep 1999 10:25:46 -0400
From: "Sankala, Dinesh" Dinesh.Sankala@lgeenergy.com
To: "'oraapps-l@cpa.qc.ca'" oraapps-l@cpa.qc.ca
Subject: RE: printer problem

hi

WE HAVE A TYPICAL REQUIREMENT HERE
WE WANNA MONITOR THE PRINT QUEAE AT unix level

like is there anyway to know that if any programme hangs in the print que at Unix level we need to find that by an alert or by a executing a pl/sql script or ....

any ideas greatly appreciated
thanks in advance
kumar


Date: Wed, 1 Sep 1999 19:28:20 +0100
From: "Steve Spencer" srs@freezone.co.uk
To: oraapps-l@cpa.qc.ca
Subject: RE: printer problem

You can look at the UNIX print queue with unix commands such as lpstat...ask your DBAs.

If you mean you want to monitor the Concurrent Requests queue from a Unix level ie outside of the application, then do as you suggest. Write a simple SQL*Plus script to query the FND_CONCURRENT_REQUESTS and associated linked tables for those records that have the particular status flag that you require (Pending or whatever). See your AOL Tech Ref manual for details of these tables and their flags.

Then get your SQL*Plus script run from inside a unix shell script and away you go...

Cheers,
Steve



Control characters in man document

From: Subramaniam Venkat venkat@irs.co.id
Reply-To: oraapps-l@cpa.qc.ca
To: Multiple recipients of list oraapps-l@cpa.qc.ca
Subject: Help from UNIX gurus
Date: Wed, 29 Sep 1999 02:57:39 -0400 (EDT)

Hello

I made a copy of the man document to text file in unix.I want to remove the control charecters (^H).How to do it with vi text editor.Can anybody help me

Thanks in advance
Regards,
Venkat - DBA
PT INDO-RAMA SYNTHETICS Tbk
Purwakarta-41101 Indonesia
Phone 62-264-202311 EXT 2526


From: Disha Dalal[SMTP:dishadalal@hotmail.com]
Reply To: oraapps-l@cpa.qc.ca
Sent: Wednesday, September 29, 1999 6:44 AM
To: Multiple recipients of list
Subject: Re: Help from UNIX gurus

Hi Venkat,

Open your text file and type in ":1,$ s/^H/ /g" obviously without the double quotes. To get the control character press control v and then control H. All the control characters will be replaced with space at once since a global command is specified.

Hope this will help you.
Disha.


Date: Wed, 6 Oct 1999 19:02:23 -0400
From: "Annamaneni, Hanumantha" Hanumantha.Annamaneni@alcoa.com
To: "'oraapps-l@cpa.qc.ca'" oraapps-l@cpa.qc.ca
Subject: RE: Help from UNIX gurus

Istead, you could use:

man command | ul -tdumb filename

and frint the file

Hanumanth