Sponsored Content
Top Forums Shell Programming and Scripting Is there a diff way to exec this shell prg?? Post 302123794 by kumarsaravana_s on Wednesday 27th of June 2007 08:39:57 AM
Old 06-27-2007
Is there a diff way to exec this shell prg??

Hi,

I want to know whether it is possible to to execute the below script like

ksh ds.ksh <input file> > <output file> or any other simple way other then ./

The way i'm executing it right now is

nawk -f ds.ksh <input file> > <output file>.

I need the first format as my ETL tools is not able to understand the nawk -f execution format.Is there any change within the program i need to do ?


#!/usr/bin/nawk -f

BEGIN {
FS=OFS="|"

FLD_max=11

FF=sprintf("\f")

}
$0 ~ FF { gsub(FF, ""); $1=$1 }

(fld + NF-1) > FLD_max {
if (fld == FLD_max)
print rec

}
##NF < FLD_max {printf("Bad record: [%d] :: [%s]\n", FNR, $0) | stderr;
NF < FLD_max {rec=(rec != "") ? rec $0 : $0; fld+=(NF-1);next }
{rec=$0; fld=NF}
END {
if (rec != "" && split(rec, a, FS) >= FLD_max ) print rec

Regards,
Kumar
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calling a prg from the shell!!!

Hi, can somebody please answer my questions: 1) is the "sh" available on all unix systems at /bin/sh ??? 2) how to make the following call working: `which java` -cp $JAVA_HOME MyClass since I do not know the location of java :-(( (4 Replies)
Discussion started by: andy2000
4 Replies

2. Shell Programming and Scripting

Exec bash shell via PHP Site !

Hi everybody ! I writed php code so exec bash shell via php (SMS Send via bash shell) but i have problem as follow : 1. When i exec from linux mode : ./sms.sh --- output is "Messages ... OK". Then all message has been sent. 2. When i exec from PHP site --- return value is "Message ... OK" on... (1 Reply)
Discussion started by: lamthenhan
1 Replies

3. Shell Programming and Scripting

how to use exec command in C shell

i have a script where i am reading some lines from a file into another file.. script works fine in bash.. #!/usr/bin/csh awk 'NR>20&&NR<32' try.sum | awk '{print $4 }' >io awk 'NR>20&&NR<32' try.sum | awk '{print $9 }' >io1 awk 'NR>20&&NR<32' try.sum | awk '{print $14 }'>io2 exec 10<io... (1 Reply)
Discussion started by: npatwardhan
1 Replies

4. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

5. Shell Programming and Scripting

Script Variables Inquiry, Values Okay in Standalone Exec, No-Show in Cron Exec

I have the following bash script lines in a file named test.sh. #!/bin/bash # # Write Date to cron.log # echo "Begin SSI Load $(date +%d%b%y_%T)" # # Get the latest rates file for processing. # d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1) filename=$d export filename... (3 Replies)
Discussion started by: ginowms
3 Replies

6. Shell Programming and Scripting

Exec shell from Ant target

hi, I have been using exec in Ant to run shell commands till now, but got a weird error now. I have an ANT target which invokes a shell script. Shell script further invokes one more shell script file to complete the work. Below is Ant Target code. <exec executable="/bin/bash"> ... (2 Replies)
Discussion started by: sukhdip
2 Replies

7. Shell Programming and Scripting

What does the following exec command do it is in the shell file?

I have a shell script, research_dump_sub.sh the first 3 lines are below. the below two lines writing to log file, i am not finding the log file, how to locate, and what is the exec command doing exactly please. and the third line again calling/triggering the shell file. i didn't understood. ... (2 Replies)
Discussion started by: cplusplus1
2 Replies

8. UNIX for Beginners Questions & Answers

Two exec commands in one shell script?

Hi Folks - Is there a way to add two execs to one script? For instance, I need to redirect the stdout and stderr to two separate directories. I want to do this: #::-- Direct STDOUT and STDERROR to repositories --::# exec 2>"${_ERRORFILE}" > "${_LOGFILE}" exec 2>"/new/path/file.err" >... (7 Replies)
Discussion started by: SIMMS7400
7 Replies

9. Programming

Simple shell running with exec family

# Erroneous question, so can be removed. (0 Replies)
Discussion started by: beginnerboy
0 Replies
CSV2REC(1)							   User Commands							CSV2REC(1)

NAME
csv2rec - csv to rec converter SYNOPSIS
csv2rec [OPTIONS]... [CSV_FILE] DESCRIPTION
Convert csv data into rec data. -t, --type=TYPE type name for the converted records; if this parameter is ommited then no type is used. -s, --strict be strict parsing the csv file. -e, --omit-empty omit empty fields. --help print a help message and exit. --version show version and exit. AUTHOR
Written by Jose E. Marchesi. REPORTING BUGS
Report bugs to: bug-recutils@gnu.org GNU recutils home page: <http://www.gnu.org/software/recutils/> General help using GNU software: <http://www.gnu.org/gethelp/> COPYRIGHT
Copyright (C) 2010, 2011, 2012 Jose E. Marchesi. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for csv2rec is maintained as a Texinfo manual. If the info and csv2rec programs are properly installed at your site, the command info csv2rec should give you access to the complete manual. csv2rec 1.4.93 January 2012 CSV2REC(1)
All times are GMT -4. The time now is 05:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy