Sponsored Content
Top Forums Shell Programming and Scripting How to execute korn shell script from different directory Post 302582348 by James_Owen on Thursday 15th of December 2011 03:03:27 PM
Old 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

korn shell script

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

korn shell script

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

Help with Korn Shell script

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

How to execute script on files in another directory?

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

how to take absolute pathname to a directory in korn shell (2 Replies)
Discussion started by: babuda0059
2 Replies

6. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

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

MKS KORN SHELL WONT EXECUTE from windows command prompt

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

how do i execute nohup and background job inside the korn script for db2

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

Help with korn shell script to get the latest file versions in a directory

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

Execute sql statment in korn shell

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
HTML::FormFu::Element::Block(3pm)			User Contributed Perl Documentation			 HTML::FormFu::Element::Block(3pm)

NAME
HTML::FormFu::Element::Block - Block element SYNOPSIS
--- elements: - type: Block elements: - type: Text name: foo - type: Block tag: span content: Whatever DESCRIPTION
Block element which may contain other elements. METHODS
tag Specifies which tag name should be used to render the block. Default Value: 'div' content If "content" is set, it is used as the block's contents, and any attached elements are ignored. content_xml Arguments: $string If you don't want the content to be XML-escaped, use the "content_xml" method instead of "content". content_loc Arguments: $localization_key To set the content to a localized string, set "content_loc" to a key in your L10N file instead of using "content". elements See "elements" in HTML::FormFu for details. element See "element" in HTML::FormFu for details. deflators See "deflators" in HTML::FormFu for details. deflator See "deflator" in HTML::FormFu for details. filters See "filters" in HTML::FormFu for details. filter See "filter" in HTML::FormFu for details. constraints See "constraints" in HTML::FormFu for details. constraint See "constraint" in HTML::FormFu for details. inflators See "inflators" in HTML::FormFu for details. inflator See "inflator" in HTML::FormFu for details. validators See "validators" in HTML::FormFu for details. validator See "validator" in HTML::FormFu for details. transformers See "transformers" in HTML::FormFu for details. transformer See "transformer" in HTML::FormFu for details. CSS CLASSES
auto_id See "auto_id" in HTML::FormFu for details. auto_block_id Arguments: [$string] If set, the Block will be given an auto-generated id attribute, if it doesn't have one already. The following character substitution will be performed: %f will be replaced by $form->id, %r will be replaced by $block->repeatable_count. Default Value: not defined Unlike most other auto_* methods, this is not an 'inherited accessor'. auto_label See "auto_label" in HTML::FormFu for details. auto_error_class See "auto_error_class" in HTML::FormFu for details. auto_error_message See "auto_error_message" in HTML::FormFu for details. auto_constraint_class See "auto_constraint_class" in HTML::FormFu for details. auto_inflator_class See "auto_inflator_class" in HTML::FormFu for details. auto_validator_class See "auto_validator_class" in HTML::FormFu for details. auto_transformer_class See "auto_transformer_class" in HTML::FormFu for details. default_args See "default_args" in HTML::FormFu for details. RENDERING
start end INTROSPECTION
get_elements See "get_elements" in HTML::FormFu for details. get_element See "get_element" in HTML::FormFu for details. get_all_elements See "get_all_elements" in HTML::FormFu for details. get_fields See "get_fields" in HTML::FormFu for details. get_field See "get_field" in HTML::FormFu for details. get_deflators See "get_deflators" in HTML::FormFu for details. get_deflator See "get_deflator" in HTML::FormFu for details. get_filters See "get_filters" in HTML::FormFu for details. get_filter See "get_filter" in HTML::FormFu for details. get_constraints See "get_constraints" in HTML::FormFu for details. get_constraint See "get_constraint" in HTML::FormFu for details. get_inflators See "get_inflators" in HTML::FormFu for details. get_inflator See "get_inflator" in HTML::FormFu for details. get_validators See "get_validators" in HTML::FormFu for details. get_validator See "get_validator" in HTML::FormFu for details. get_transformers See "get_transformers" in HTML::FormFu for details. get_transformer See "get_transformer" in HTML::FormFu for details. get_errors See "get_errors" in HTML::FormFu for details. clear_errors See "clear_errors" in HTML::FormFu for details. SEE ALSO
Base-class for HTML::FormFu::Element::Fieldset. Is a sub-class of, and inherits methods from HTML::FormFu::Element HTML::FormFu REMOVED METHODS
element_defaults Has been removed; use "default_args" instead. 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::Element::Block(3pm)
All times are GMT -4. The time now is 04:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy