12-01-2015
For loop/while condition - doubt
hi.,
As we know that using for-loop or while condition, we can only process one by one sequentially[according to provided input details], but , lets say this example :
1. under the folder "logs" there are 1000 files
2. each file has one record or line
3. have to perform atleast 7 queries per 3 seconds ,for instance
parse and process 7 files [each file has 1 record] in every three seconds
Can any one please share on how to do this shell or perl or python way.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
I have a doubt on condition test ( ] ). Pls refer blow program.
#!/bin/ksh
TEMP=
if ;then
echo $TEMP
else
print 'invalid option'
fi
Above script's TEMP variable has no value so it gives "invalid option" as output. But I got an error before priting the string .
Result :
... (2 Replies)
Discussion started by: thambi
2 Replies
2. UNIX for Dummies Questions & Answers
i have got a file where the env command is appended 5 times. i have to now look for the username and display it in the form of
1) PWD=/home/lee.ballancore
2) USER=lee.ballancore
3) MAIL=/var/spool/mail/lee.ballancore
4) LOGNAME=lee.ballancore
5) HOME=/home/lee.ballancore
6)... (1 Reply)
Discussion started by: nehaquick
1 Replies
3. Shell Programming and Scripting
Hi i found the following code in a date calculation script.
if ((!(year%100))); then
((!(year%400))) && leap=1
else
((!(year%4))) && leap=1
fi
I have not find such an use of if statement till now.
As for my knowledge this is the syntax of if statement
if
then
... (1 Reply)
Discussion started by: ravi raj kumar
1 Replies
4. 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
5. Shell Programming and Scripting
Hi,
I am facing issues with test condition. I had a compound condition to write for both if and while,
In one of the texts i referred, with a korn shell we can write compound statements like: ], however this doesn't worked for me. For example:
if ] doesn't works, but
if || worked.
... (1 Reply)
Discussion started by: amritps
1 Replies
6. Shell Programming and Scripting
Gurus,
I need to read a line from a file and strip the characters from it and compare the stripped value with the value I pass to the script while executing it. Below is the code for the same. But when i execute the code, it is throwing an error.
#!/bin/ksh
. /home/.i_env
... (14 Replies)
Discussion started by: svajhala
14 Replies
7. Shell Programming and Scripting
Hi,
Could you please tell what is the meaning of -z in while loop condition.
For example,
while ; do
echo "*** Enter the age "
readage (3 Replies)
Discussion started by: vidyaj
3 Replies
8. Shell Programming and Scripting
hello,
I would like to do exit at the end ie list all errors before exiting
How to put the token exit in a variable with a loop ?
Thanks
function g1 () {
case "$1" in
(-0-0 | -0-1 | -0-2 | -0-3 | -1-0 | -1-1 | -1-2 | -1-3)
# nothing, OK !
;;
(*)
echo 'Fatal, $1 = '"'$1'"', Date... (9 Replies)
Discussion started by: amazigh42
9 Replies
9. Shell Programming and Scripting
Hi,
I was trying to write a shell script which reads csv file and sends mail in html format along with tables. Hope i have completed 1st part , but while sending mail i was trying to highlight some rows in the table based on the egrep outcome. If the string exists in line/INPUT, i am trying to... (4 Replies)
Discussion started by: varmas424
4 Replies
10. UNIX for Dummies Questions & Answers
Hi All,
I wrote a for loop where i am trying to delete the 1st line of each file and append then into a single file, my code looks like this but i am not sure if its right or worng . Can any one correct me if i am worng.
FILES=path/to/files/date_*.csv
for f in $FILES
do
sed '1d' >>... (7 Replies)
Discussion started by: vikatakavi
7 Replies
POSTLOG(1) General Commands Manual POSTLOG(1)
NAME
postlog - Postfix-compatible logging utility
SYNOPSIS
postlog [-iv] [-c config_dir] [-p priority] [-t tag] [text...]
DESCRIPTION
The postlog(1) command implements a Postfix-compatible logging interface for use in, for example, shell scripts.
By default, postlog(1) logs the text given on the command line as one record. If no text is specified on the command line, postlog(1) reads
from standard input and logs each input line as one record.
Logging is sent to syslogd(8); when the standard error stream is connected to a terminal, logging is sent there as well.
The following options are implemented:
-c config_dir
Read the main.cf configuration file in the named directory instead of the default configuration directory.
-i Include the process ID in the logging tag.
-p priority (default: info)
Specifies the logging severity: info, warn, error, fatal, or panic. With Postfix 3.1 and later, the program will pause for 1 second
after reporting a fatal or panic condition, just like other Postfix programs.
-t tag Specifies the logging tag, that is, the identifying name that appears at the beginning of each logging record. A default tag is used
when none is specified.
-v Enable verbose logging for debugging purposes. Multiple -v options make the software increasingly verbose.
ENVIRONMENT
MAIL_CONFIG
Directory with the main.cf file.
CONFIGURATION PARAMETERS
The following main.cf parameters are especially relevant to this program.
The text below provides only a parameter summary. See postconf(5) for more details including examples.
config_directory (see 'postconf -d' output)
The default location of the Postfix main.cf and master.cf configuration files.
import_environment (see 'postconf -d' output)
The list of environment parameters that a privileged Postfix process will import from a non-Postfix parent process, or name=value
environment overrides.
syslog_facility (mail)
The syslog facility of Postfix logging.
syslog_name (see 'postconf -d' output)
A prefix that is prepended to the process name in syslog records, so that, for example, "smtpd" becomes "prefix/smtpd".
SEE ALSO
postconf(5), configuration parameters
syslogd(8), syslog daemon
LICENSE
The Secure Mailer license must be distributed with this software.
AUTHOR(S)
Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA
Wietse Venema
Google, Inc.
111 8th Avenue
New York, NY 10011, USA
POSTLOG(1)