Sponsored Content
Top Forums Shell Programming and Scripting Order text display not correct. Post 302144675 by raccsdl on Friday 9th of November 2007 05:36:25 AM
Old 11-09-2007
Order text display not correct.

My shell script below for import data to Oracle

it run okay. but the text display not correct follow order command executed.

=========================Shell Script code=================

#!/bin/sh

#directory = ${1-'pwd'}


#run import data with SQLLoader
runSQLLoader()
{
/home/oracle/app/oracle/product/11.1.0/db_2/bin/sqlldr test/12345@orcl control=$1 bad=$2 log=$3 discard=$4 data=$5 direct=TRUE;
if [$? -ne 0]
then
return 1
else
return 0
fi
}

ARGS=1
filecontrol="ControlFile/test.ctl"

if [ $# -ne "$ARGS" ];
then
directory=`pwd`
else
directory=$1
fi

for file in $(find $directory -type f )
do
fname=`basename $file`

#display the file to miport data
echo "Excute importing file : $fname "

#asking user waiting for this job finish
echo "Please waiting for you look finished task"

errorfile="Error/$fname"
processedfile="Processed/$fname"
badfile="Processed/bad$fname"
discardfile="Processed/discard$fname"
logfile="Processed/log$fname"

#run function above
runSQLLoader $filecontrol $badfile $logfile $discardfile $file;
#get result of importing data if 1 have error or 0 it importing okay
if [$? -ne 0]
then
echo "Error ! Have an error happen during import data "
mv "$file" "$errorfile"
else
echo "Finish importing file : $fname"
mv "$file" "$processedfile"
fi
done | sort

exit 0
======================End Shell Script code=================

Result display is not correct

Excute importing file : test01
Excute importing file : test02
Finish importing file : test01
Finish importing file : test02
Load completed - logical record count 6369.
Load completed - logical record count 7925.
Please waiting for you look finished task
Please waiting for you look finished task
SQL*Loader: Release 11.1.0.6.0 - Production on Fri Nov 9 04:20:30 2007
SQL*Loader: Release 11.1.0.6.0 - Production on Fri Nov 9 04:20:31 2007

correct order must be like this

Excute importing file : test01
Please waiting for you look finished task
SQL*Loader: Release 11.1.0.6.0 - Production on Fri Nov 9 04:20:30 2007
Load completed - logical record count 6369.
Finish importing file : test01

Excute importing file : test02
Please waiting for you look finished task
SQL*Loader: Release 11.1.0.6.0 - Production on Fri Nov 9 04:20:31 2007
Load completed - logical record count 7925.
Finish importing file : test02

I did not why it display like that. Smilie


Please help me for correct order follow my run command in script ?
or please explain for me more about what happen when I print out the text. Smilie

Thank so much for your help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Echo display alignment/sort order

Hi, My script prints a few varibales as each it reads each line of a text file and then prints them on screen, however iam having problem in aligning and sorting them. what happens is this Last First Number Mark leo 87798798... (1 Reply)
Discussion started by: shackman66
1 Replies

2. UNIX for Advanced & Expert Users

Display modified files in ascending order

Hello, i want to display modified files in descending order. "ls -t" will display modified files in descending order. pls help. (1 Reply)
Discussion started by: balareddy
1 Replies

3. Shell Programming and Scripting

Ascending order within text

I appreciate all the help that I've already received but am running into one problem. I can find how to add something before a file with ascending numbers but not like this. I basically have a file that looks like this: 100 101 102 103 104 I need to add the following before each line with... (5 Replies)
Discussion started by: kerpm
5 Replies

4. Shell Programming and Scripting

Unable to get the correct sort order in perl.

Hi, I have created the hash. %hash; @arr1 = qw(Dealnum AdminStatus adminReason effFrom effTo); @arr2 = qw(121212121 YES 1992-06-19T05:14:27 ); @hash{@arr1}=@arr2; foreach(sort keys %hash){ print "$_ ---- $hash{$_}\n"; } The output i got like this: C:\strawberry\perl\bin>perl... (1 Reply)
Discussion started by: vanitham
1 Replies

5. UNIX for Advanced & Expert Users

v$sql not display correct sql_text

Hi folks, I am facing one problem with v$sql, i need to store updating sql query in temp table when one trigger get fired on some update sql statement. but with "sql_text" , i am not getting correct update statement in temp table. I am getting sql_text with this cursor statement. select... (0 Replies)
Discussion started by: apskaushik
0 Replies

6. UNIX for Dummies Questions & Answers

Text order

Hello unix.com I have a large text file in this format: merali guzman 34 vernon st 304 hartford CT Connecticut 6106 012-233-232 Working 13/14 100$ Morgan Dvorak 5670 Echo Road Excelsior MN Minnesota 5331 000-000-123 Sleeping 15/17 220$ How can... (1 Reply)
Discussion started by: galford
1 Replies

7. UNIX for Dummies Questions & Answers

Email display not correct on Solaris 10

Hi Everyone, Can someone possibly point me in the direction? When I execute command echo "hello" | sendmail -v testacct@wyx.com I recived an email as expected except the From: NAME is incorrect. The server name is correct. It should read "From: TESTBOX1 " actual email: From: app... (3 Replies)
Discussion started by: smckech1972
3 Replies

8. Shell Programming and Scripting

How to print the output in correct order?

Hi, while using following awk commend I’m getting confused, The output is not like as the row present in input files, can anyone explain and tell me how to print in the order like in input. value=$(awk 'FNR>1 && NR==FNR{a=$4;next} a{sum+=$4} END {for(i in sum){printf i"\t"sum/2"@@";}}'... (5 Replies)
Discussion started by: Shenbaga.d
5 Replies

9. Linux

How to display all daemon processes in priority order?

Hi, Is there any way to run chkconfig --list and to display all daemon processes in PRIORITY order, not in alphabetic order? Thank you. (4 Replies)
Discussion started by: hce
4 Replies

10. Shell Programming and Scripting

Display calendar in correct format using shell script

Hi All, I'm trying to print calendar using shell script and i'm able to print it. But the format is not good. Here is the script. #!/bin/bash echo $(date) echo "Hello $USER" echo Hostname $(hostname) echo Working in $(pwd) echo Here is this month calender echo $(cal) $ sh first.sh... (7 Replies)
Discussion started by: chandrakanth
7 Replies
NPM-RUN-SCRIPT(1)                                                                                                                NPM-RUN-SCRIPT(1)

NAME
npm-run-script - Run arbitrary package scripts SYNOPSIS
npm run-script <command> [--silent] [-- <args>...] alias: npm run DESCRIPTION
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts. run[-script] is used by the test, start, restart, and stop commands, but can be called directly, as well. When the scripts in the package are printed out, they're separated into lifecycle (test, start, restart) and directly-run scripts. As of ` https://blog.npmjs.org/post/98131109725/npm-2-0-0, you can use custom arguments when executing scripts. The special option -- is used by getopt https://goo.gl/KxMmtG to delimit the end of the options. npm will pass all the arguments after the -- directly to your script: npm run test -- --grep="pattern" The arguments will only be passed to the script specified after npm run and not to any pre or post script. The env script is a special built-in command that can be used to list environment variables that will be available to the script at run- time. If an "env" command is defined in your package, it will take precedence over the built-in. In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write: "scripts": {"test": "tap test/*.js"} instead of "scripts": {"test": "node_modules/.bin/tap test/*.js"} to run your tests. The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the /bin/sh command, on Windows it is the cmd.exe. The actual shell referred to by /bin/sh also depends on the system. As of ` https://github.com/npm/npm/releases/tag/v5.1.0 you can customize the shell with the script-shell configuration. Scripts are run from the root of the module, regardless of what your current working directory is when you call npm run. If you want your script to use different behavior based on what subdirectory you're in, you can use the INIT_CWD environment variable, which holds the full path you were in when you ran npm run. npm run sets the NODE environment variable to the node executable with which npm is executed. Also, if the --scripts-prepend-node-path is passed, the directory within which node resides is added to the PATH. If --scripts-prepend-node-path=auto is passed (which has been the default in npm v3), this is only performed when that node executable is not found in the PATH. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install, just in case you've forgotten. You can use the --silent flag to prevent showing npm ERR! output on error. You can use the --if-present flag to avoid exiting with a non-zero exit code when the script is undefined. This lets you run potentially undefined scripts without breaking the execution chain. SEE ALSO
o npm help 7 scripts o npm help test o npm help start o npm help restart o npm help stop o npm help 7 config January 2019 NPM-RUN-SCRIPT(1)
All times are GMT -4. The time now is 06:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy