Sponsored Content
Top Forums Shell Programming and Scripting Can ls in ksh write to output? Post 302280732 by bhagya2340 on Tuesday 27th of January 2009 01:12:43 PM
Old 01-27-2009
Can ls in ksh write to output?

I have a ksh script written by someone... now i am trying to modify it to my requirement....

Its executed like this

Read.ksh load ${CUR_MAINT_DATE}

Code:
 
if [ "${1}" = "" ]
then
 filnam="Load_CLM"
else
 filnam="${1}"
fi
if [ ! "${2}" = "" ]
then
 CUR_MAINT_DATE="${2}"
fi
if [ -f ${LOG_DIR}/${CUR_MAINT_DATE}/${filnam}_200*log ]
then
  ls ${LOG_DIR}/${CUR_MAINT_DATE}/${filnam}_200*log
  grep 'STEP 00' ${LOG_DIR}/${CUR_MAINT_DATE}/${filnam}_200*log > r.tmp
  date1=`tail -1 r.tmp | cut -f2 -d '[' | cut -f1 -d ']'`
  grep 'Completed at \[' ${LOG_DIR}/${CUR_MAINT_DATE}/${filnam}_200*log > r.tmp
  date2=`tail -1 r.tmp | cut -f2 -d '[' | cut -f1 -d ']'`
  rm -f r.tmp

This code actually writes to a file... when i see in the file i see the value of {LOG_DIR}/${CUR_MAINT_DATE}/${filnam}_200*log
its the location of the log file... now we dont want it and i am not able to figure out what is giving that output...
After putting some echo statements i found that its thai statement thats writing
Code:
 
ls ${LOG_DIR}/${CUR_MAINT_DATE}/${filnam}_200*log

I kept echo after every line to see which line is writing... Can anyone say me what i have to do so that it doesnt write the value of ${LOG_DIR}/${CUR_MAINT_DATE}/${filnam}_200*log to output...

Thanks a lot
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to write a varible into file in ksh

set filename $logDir/PyLog/$logname echo $filename >> logname.txt I am trying to write to write the varibale filename into a file logname.txt,it is not working could any one suggest y (2 Replies)
Discussion started by: nathgopi214
2 Replies

2. Shell Programming and Scripting

Write process output to a file

When I run <ls -l> to get a list of all the files, I want the displayed result to be written to a text file. Is there a way to do that? (1 Reply)
Discussion started by: kn.naresh
1 Replies

3. Shell Programming and Scripting

How do I write a ksh script that will check if all ftp files are received?

I am trying to code a ksh script that will check to see if all 26 incoming ftp files have been received before proceeding to the next function, which is to rename each file. Here is the pseudo-code of what I am trying to do: <<STEP_1>> IF all ALS files have been transmitted then... (2 Replies)
Discussion started by: doug145
2 Replies

4. Shell Programming and Scripting

output to write in a file

hi all, when i try to start an applicationserver for an example: ./kStart.sh > out.txt so kStart.sh script will start the application server and write the details to out.txt but in mycase... it is writing to out.txt and as well it is showing in the prompt also... I want only the... (2 Replies)
Discussion started by: raghur77
2 Replies

5. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

6. Red Hat

write execl output to file

hi, how to write the resullt of execl() into another file. i used write(fd,execl()); (1 Reply)
Discussion started by: Mahendravarma
1 Replies

7. Shell Programming and Scripting

KSH - need to write a script to abbreviate a string

Dear Members, I have to write a UNIX script (KSH) to create a 6 letter abbreviation from a given string. The string will have alphabets and underscores only. e.g. abc_pst_xyz is our string and I have to create an abbreviation which will look like 'abpsxy' or 'abcpyz' etc. Now comes the... (8 Replies)
Discussion started by: Yoodit
8 Replies

8. Shell Programming and Scripting

Filter out output and then write to a file

I have a process which writes lots of output to the screen and am capturing it to a file. But the issue is that there are few lines which repeat every second which is causing the file size to be enormous. I am trying to filter out and then run the command but its not working. Can you confirm... (7 Replies)
Discussion started by: rajkumarme_1
7 Replies

9. Shell Programming and Scripting

Write result to output file

Good morning everybody, Beeing an absolute newbie in shell scripting I would like to look for some help here. I would like to read an external text file and format the data and write it to an output file. What I was trying to do was to display the result (this worked). But now I... (1 Reply)
Discussion started by: bluejean1976
1 Replies

10. UNIX for Dummies Questions & Answers

Changes to write output to logfile and console

Friends, Below is the script which writes output to LOGFILE, however I want the entire log written to LOGFILE and also console. Please suggest me the changes I need to do here. #!/bin/ksh x=${0##*/} LOGFILE="x.log" echo "CAUTION : Files once deleted cannot be restored" printf 'Would... (8 Replies)
Discussion started by: fop4658
8 Replies
GLANCE-CACHE-PRUNER(1)						      Glance						    GLANCE-CACHE-PRUNER(1)

NAME
glance-cache-pruner - Glance Cache Pruner GLANCE CACHE PRUNER
Author glance@lists.launchpad.net Date 2012-01-03 Copyright OpenStack LLC Version 2012.1-dev Manual section 1 Manual group cloud computing SYNOPSIS glance-cache-pruner [options] DESCRIPTION This is meant to be run as a periodic task, perhaps every half-hour. OPTIONS --version show program's version number and exit -h, --help show this help message and exit --config-file=PATH Path to a config file to use. Multiple config files can be specified, with values in later files taking precedence. The default files used are: [] -d, --debug Print debugging output --nodebug Do not print debugging output -v, --verbose Print more verbose output --noverbose Do not print more verbose output --log-config=PATH If this option is specified, the logging configuration file specified is used and overrides any other logging options specified. Please see the Python logging module documentation for details on logging configuration files. --log-format=FORMAT A logging.Formatter log message format string which may use any of the available logging.LogRecord attributes. Default: none --log-date-format=DATE_FORMAT Format string for %(asctime)s in log records. Default: none --log-file=PATH (Optional) Name of log file to output to. If not set, logging will go to stdout. --log-dir=LOG_DIR (Optional) The directory to keep log files in (will be prepended to --logfile) --use-syslog Use syslog for logging. --nouse-syslog Do not use syslog for logging. --syslog-log-facility=SYSLOG_LOG_FACILITY syslog facility to receive log lines SEE ALSO o OpenStack Glance BUGS o Glance is sourced in Launchpad so you can view current bugs at OpenStack Glance AUTHOR
OpenStack COPYRIGHT
2010-present, OpenStack, LLC. 2012.1.1 March 14, 2013 GLANCE-CACHE-PRUNER(1)
All times are GMT -4. The time now is 12:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy