11-12-2011
Your approach isn't working because fext is being set before any input lines are seen. Thus, fext is true if and only if the first argument matches a file with the extension "st". It wont matter what the rest of the arguments are. Further, the FNR==NR mechanism works only to distinguish the very first file from the rest. If you add files to the argument list, they will all be processed as if they were the first file read the second time.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I have one clarification i am using the loop which will process for each record .suppose there is f ailure in the first record it need to send mail and process the next .my code:
defcount=`cat <filename>|wc -l`
while ]
do
if <some condiotion>
then
echo "mail"
fi
done
so... (1 Reply)
Discussion started by: ithirak17
1 Replies
2. Shell Programming and Scripting
I have a for loop in my script as shown below.
for file_path in $file_list ; do
........my code
..........
......
done
Can i restrict the number of files parsing to the variable file_path as 50?
That is, even if I have some 100 files in file_list, I need to take only 50 files for... (7 Replies)
Discussion started by: Vijay06
7 Replies
3. Shell Programming and Scripting
I have a logic like this
It initializes the flag variable as "T" at the beginning of the loop everytime
Inside each loop it checks for two conditions and updates the flag variable as "A" or "B"
In the end of the loop it checks for the value of the variable flag for "A" or "B" and execute... (4 Replies)
Discussion started by: codeman007
4 Replies
4. Shell Programming and Scripting
Hi
source is text file named alpha.text containing entries
ABC
DEF
XYZ
YYY
BBB
I need a small shell script which should do read the entries in alpha.text one by one and check it with the current date. If the date is Mon (monday) and entry read from the file is 'DEF' then this should... (4 Replies)
Discussion started by: PrasannaKS
4 Replies
5. Shell Programming and Scripting
Hi All,
I am facing a alien problem in unix shell script.
i have a requirement where i have to check first whether a particular file has been created or not if that file has been created then that file needs to be ftped to a particular dir.
My Code is like that
Success='code for file... (3 Replies)
Discussion started by: aryan_styles
3 Replies
6. Shell Programming and Scripting
hi i need help with below code.
if ]
then
log "Exiting the script as ID= NULL"
log "Please run script first."
fi
i am calling grep inside this but its not running any ideas why ??
input file is like this --
Msg 102, Level 20, State 1:
Server... (4 Replies)
Discussion started by: dazdseg
4 Replies
7. Shell Programming and Scripting
Hi,
I am in trouble. I can get inside my condition test inside a loop :
I am in ksh (solaris)
while read file
do
<commande to retrieve file> >> ${LOG_RETRIEVE_FILE.log}
msg_err=$(cat ${LOG_RETRIEVE_FILE.log} | grep "error retrieve")
if ; then
<sendmail>
exit 1
fi
done
I tried... (6 Replies)
Discussion started by: Aswex
6 Replies
8. Shell Programming and Scripting
I have the following in an awk script. I want to do them on condition that: fext == "xt"
FNR == NR {
/>/ && idx = ++i
$2 || val = $1
next
}
FNR in idx { v = val] }
{ !/>/ && srdist = abs($1 - v) }
/>/ || NF == 2 && srdist < dsrmx {... (1 Reply)
Discussion started by: kristinu
1 Replies
9. Shell Programming and Scripting
Hello experts,
I'm stuck with this script for three days now. Here's what i need.
I need to split a large delimited (,) file into 2 files based on the value present in the last field.
Samp: Something.csv
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
def,adc,asdf,123,12A
I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies
10. Shell Programming and Scripting
Hi ,
Please excuse me for opening a new thread i am unable to find out the syntax error
in my if else condition inside for loop in awk command ,
my actual aim is to print formatted html td tag when if condition (True) having string as "failed",
could anyone please advise what is the right... (2 Replies)
Discussion started by: karthikram
2 Replies
LEARN ABOUT ULTRIX
st_extadd
stcu(3) Library Functions Manual stcu(3)
Name
stcu, st_cuinit, st_setchdr, st_currentpchdr, st_free, st_extadd, st_pext_iext, st_pext_rndx, st_iextmax, st_extstradd, st_str_extiss,
st_idn_index_fext, st_idn_rndx, st_pdn_idn, st_rndx_idn, st_setidn - routines that provide a compilation unit symbol table interface
Syntax
#include <syms.h>
pCHDRR st_cuinit ()
void st_setchdr (pchdr)
pCHDRR pchdr;
pCHDRR st_currentpchdr()
void st_free()
long st_extadd (iss, value, st, sc, index)
long iss;
long value;
long st;
long sc;
long index;
pEXTR st_pext_iext (iext)
long iext;
pEXTR st_pext_rndx (rndx)
RNDXR rndx;
long st_iextmax()
long st_extstradd (str)
char *str;
char *st_str_extiss (iss)
long iss;
long st_idn_index_fext (index, fext)
long index;
long fext;
long st_idn_rndx (rndx)
RNDXR rndx;
pRNDXR st_pdn_idn (idn)
long idn;
RNDXR st_rndx_idn (idn)
long idn;
void st_setidn (idndest, idnsrc)
long idndest;
long idnsrc;
Description
The stcu routines provide an interface to objects that occur once per object, rather than once per file descriptor (for example, external
symbols, strings, and dense numbers). The routines provide access to the current chdr (compile time hdr), which represents the symbol ta-
ble in running processes with pointers to symbol table sections rather than indices and offsets used in the disk file representation.
A new symbol table can be created with st_cuinit. This routine creates and initializes a CHDRR (see cmplrs/stsupport.h). The CHDRR is the
current chdr and is used in all later calls. A chdr can also be created with the read routines (see The st_cuinit routine returns a
pointer to the new CHDRR record.
st_currentchdr Returns a pointer the current chdr.
st_setchdr Sets the current chdr to the pchdr argument and sets the per file structures to reflect a change in symbol tables.
st_free Frees all constituent structures associated with the current chdr.
st_extadd Lets you add to the externals table. It returns the index to the new external for future reference and use. The ifd field
for the external is filled in by the current file (see For more details on the parameters, see sym.h.
st_pext_iext and st_pext_rndx
Returns pointers to the external, given a index referencing them. The latter routine requires a relative index where the
index field should be the index in external symbols and the rfd field should be the constant ST_EXTIFD. NOTE: The externals
contain the same structure as symbols (see the SYMR and EXTR definitions).
st_iextmax Returns the current number of entries in the external symbol table.
The iss field in external symbols (the index into string space) must point into external string space.
st_extstradd Adds a null-terminated string to the external string space and returns its index.
st_str_extiss Converts that index into a pointer to the external string.
The dense number table provides a convenience to the code optimizer, generator, and assembler. This table lets them reference symbols from
different files and externals with unique densely packed numbers.
st_idn_index_fext
Returns a new dense number table index, given an index into the symbol table of the current file (or if fext is set, the
externals table).
st_idn_rndx Returns a new dense number, but expects a RNDXR (see sym.h to specify both the file index and the symbol index rather than
implying the file index from the current file. The RNDXR contains two fields: an index into the externals table and a file
index rsyms can point into the symbol table, as well). The file index is ST_EXTIFD (see stsupport.h) for externals.
st_rndx_idn Returns a RNDX, given an index into the dense number table.
st_pdn_idn Returns a pointer to the RNDXR index by the idn argument.
See Also
stfe(3), stfd(3)
RISC stcu(3)