Korn Shell Tips by klutzfu48

VIEWS: 61 PAGES: 3

									Korn Shell Tips

Written by Steve Leonard
Monday, 23 February 2009 12:21 -

redirect output to email

<commandf>   2>&1|/usr/ucb/mail -s "Equity Swaps Mail" sleonard




# We want to ensure that program exits with 0 exit status
trap 'exit 0' EXIT TERM HUP QUIT INT




shows how long a cjob has run for

usage:
 /usr/bin/time <command> [command arguments..]




convert to lower case (ksh)
echo Test | dd conv=lcase

or ucase




find and remove files over 15 days old
/usr/bin/find /home/creddev/data -mtime +15 -type f -follow  -exec /usr/bin/rm -f {} ;

 




redirect errors to same file
<cmd> > file 2>&1




email files
sed 's/,/ /g' /tmp/T_Swap_RiskManPositions.$$ | sed 's/ /,/g' | uuencode



                                                                                         1/3
Korn Shell Tips

Written by Steve Leonard
Monday, 23 February 2009 12:21 -

T_Swap_RiskManPositions${date}.csv >> /tmp/mail_swaps.$$

/usr/ucb/mail -s "Swap position file for $date" $MAILLIST < /tmp/mail_swaps.$$




Number of CPUs
/usr/sbin/psrinfo -v
/usr/platform/`uname -i`/sbin/prtdiag -v
/usr/bin/mpstat




see what servers are available
ypcat host2.byname|grep rsk
ping <name>




redirect to isql
/usr/local/sybase/bin/isql -Ucridba -Pcridba  -SCREDIT_TEST << !

PRINT "TRUNCATING exposures TABLE"
use exposures
go
truncate table exposures
go
!




Change delete key
stty erase ^H




DEFAULT_DBTRACE=<log file location>
 output all SQL transactions
 
sp_lock
 can give details of processes locking DB
sp_who



                                                                                 2/3
Korn Shell Tips

Written by Steve Leonard
Monday, 23 February 2009 12:21 -

 can give pid of processes that are blocking DB




Process Running
ps -auxww

ps -ef




redirect unix mail
create file .forward with write access only for me and inside write the email address to redirect to




 




                                                                                              3/3

								
To top