12-15-2011
How to execute korn shell script from different directory
Guy's ,
I need to run korn shell script from different directory, usually I run the script using ./details.ksh in the same directory but now I need to run the file and process details using awk code.
Now I am running the script this way but with no luck
HTML Code:
Directory = home/users/work
HTML Code:
${Directory}/details.ksh| awk '
{
gsub( ">", "" ); # strip uneeded junk and make "foo bar" easy to capture
gsub( " ", "~" );
gsub( "<", " " );
for( i = 1; i <= NF; i++ ) # snarf up each name=value pair
{
if( split( $(i), a, "=" ) == 2 )
{
gsub( "\"", "", a[2] );
gsub( "~", " ", a[2] );
values[a[1]] = a[2];
}
}
#gcount[values["Gender"]]++; # collect counts
#acount[values["Age"]]++;
agcount[values["Gender"]","values["Age"]]++;
printf( "%s %s %s %s\n", values["NAME"], values["Age"], values["D.O.B"], values["Gender"] );
}
END {
printf( "\nSummary\n" );
for( x in agcount )
printf( "%s,%d\n", x, agcount[x] ) | "sort";
}
' input-file
This code is in different directory i.e.
HTML Code:
home/TestDir/awkwork
Can I please get help with this?
Any help is appreciated.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hello.,
i have 2 files..
1 file is in this folder
/home/test/ssk/DSA.WLG.20050713211544.20050710.20050713211544
(this part)
other file is in this folder
/home/kk/dev/DSA.WLG.20050711210100.20050710.20050711210100
... (1 Reply)
Discussion started by: pavan_test
1 Replies
2. UNIX Desktop Questions & Answers
hi all
i am writing the korn shell script.
i have a SQL script which gives me the folowing output
DSA.WLG.20050713211544.20051025.20050713211544 28991 1130198400
DSA.WLG.20050713211544.20051025.20050713211544 25881 1130198400
DSA.WLG.20050711210100.20051025.20050711210100 25881 ... (3 Replies)
Discussion started by: pavan_test
3 Replies
3. AIX
I have this Korn shell script that runs via a cron entry. It runs in a loop "watching" a specific file system for files with a certain name. The file system that it is watching is an upload file system for an FTP server. When files that are the correct name come in, it takes the extension of the... (1 Reply)
Discussion started by: heprox
1 Replies
4. Shell Programming and Scripting
Hi Guys,
Is there any way I can execute my bash script on files in a different folder than what the script is in? Here is an excerpt of my script:
#!/usr/bin/bash
input_path="/cygdrive/c/files"
output_path="/cygdrive/c/files/data"
#script uses files from /cygdrive/c/files directory,... (1 Reply)
Discussion started by: npatwardhan
1 Replies
5. Shell Programming and Scripting
how to take absolute pathname to a directory in korn shell (2 Replies)
Discussion started by: babuda0059
2 Replies
6. Shell Programming and Scripting
i want use ssh on the host01 to execute autoexec.sh on the host02 like following :
host01> ssh host02 autoexec.sh
autoexec.sh include nohup command like follwing :
nohup /home/jack/deletedata.sh &
after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies
7. Shell Programming and Scripting
Can anybody help me with this small script , the script works fine and launches the IE from
c:\documents and settings \test\my documents>ksh prompt
$RunURL1.sh
this scitpt works and launches the ie from ksh , but when i schedule it to run the script then i get the error box saying command:1... (2 Replies)
Discussion started by: venu
2 Replies
8. Shell Programming and Scripting
load_cursor_stmt()
{
ls /db/admin/ddl/rmn01000/load_cursor*.sql|while read file
do
echo "${file}"
`nohup db2 -tvf "$file" \&`
done
}Error:
-------
/admin/ddl/rmn01000/load_cursor5.sql /db/admin/ddl/rmn01000/load_cursor6.sql
+ read file
+ echo... (3 Replies)
Discussion started by: Hangman2
3 Replies
9. Shell Programming and Scripting
I want to write a korn shell script to get the latest three versions for a file in the directory having lot of files with various versions (files with prefix as same but time stamp as suffix) and compress it and at the same time have to remove the remaining versions of the file (other than latest... (4 Replies)
Discussion started by: maheshbabu
4 Replies
10. Shell Programming and Scripting
I am fairly new to writing scripts, and have gotten a lot of help from this site in the past with many of the posts.
I have a question/issue with a script I am attempting to write and have a question regarding executing an sql statement inside of a loop (do while). I have in the past written... (1 Reply)
Discussion started by: josbor01
1 Replies
LEARN ABOUT DEBIAN
html::formfu::plugin
HTML::FormFu::Plugin(3pm) User Contributed Perl Documentation HTML::FormFu::Plugin(3pm)
NAME
HTML::FormFu::Plugin - base class for plugins
DESCRIPTION
Plugins can be added to a form or any element to modify their behaviour. Some plugins should only be added to either a form, or an
element, depending on their design.
METHODS
Plugins can override any of the following method stubs.
process
Only plugins added to a form or a field element inheriting from HTML::FormFu::Element::_Field will have their "process" method run.
For form plugins, is called during "process" in HTML::FormFu, before "process" is called on any elements.
For field plugins, is called during the field's "process" call.
pre_process
For form plugins, is called immediately after "pre_process" is run on the elements.
For element plugins, is called before "pre_process" is run on form plugins.
post_process
For form plugins, is called immediately before "process" in HTML::FormFu returns.
For element plugins, is called before "post_process" is run on form plugins.
render
Only plugins added to a form will have their "render" method run.
Is called during "render" in HTML::FormFu before the "render_method" in HTML::FormFu is called.
post_render
Only plugins added to a form will have their "post_render" method run.
Is called during "render" in HTML::FormFu immediately before "render" in HTML::FormFu return.
Is passed a reference to the return value of "render_method" in HTML::FormFu.
CORE PLUGINS
HTML::FormFu::Plugin::StashValid
AUTHOR
Carl Franks, "cfranks@cpan.org"
LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-01-23 HTML::FormFu::Plugin(3pm)