02-07-2012
Quote:
Originally Posted by
vsachan
Thanks Corona...
But it is giving error...
gunzip -c ABCDEF.gz | awk -F, -v T1="20:00:00" -v T2="20:01:00" '{if(T1>=$2)&&(T2<=$2) print $0'
error is:
Syntax Error The source line is 1.
The error context is
>>> {if(T1>=$2)&& <<<
awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.
Try the code I actually gave you instead of rewriting it into something broken.
The version you wrote is very redundant( X { print $0 } is equivalent to just X ) and missing tons of important brackets -- i.e. you forgot the ending }, and didn't put the if-statement in its own ().
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i want to compare the timestamp of the 2 file..
please let me know how we can achive this.. (2 Replies)
Discussion started by: mail2sant
2 Replies
2. AIX
I want to read a log file from a particular location.In the logfile , lines contains timestamp.I need to compare the timestamp in the logfile with the current date.If the timpestamp in the log file is less than 4 hours then i need to read the file from that location.Below is the file format.Please... (1 Reply)
Discussion started by: achu
1 Replies
3. AIX
I want to read a log file from a particular location.In the log file each line starts with timestamp.I need to compare the timestamp in the logfile with the current date.If the timpestamp in the log file is less than 4 hours then i need to read the file from that location.Below is the file... (1 Reply)
Discussion started by: achu
1 Replies
4. Shell Programming and Scripting
Hello,
I've created the script below to compare the content of two files with a delay of an hour. After an hour, the lines that exist in both files, will be printed and executed.
The script now uses a counter to countdown 50 minutes. But what I would prefer is to check the file timestamp of... (3 Replies)
Discussion started by: taipan
3 Replies
5. Shell Programming and Scripting
I'm trying to compare 2 dates between current time and the timestamp on a file.
The date format is mmdd
Both return Apr 1 but when using if statement
line 11: Apr 1: command not found error is returned
#!/bin/sh
log="DateLog"
Current_Date=`date +%b%e`
Filepmdate=`ls -l /file.txt |... (1 Reply)
Discussion started by: cillmor
1 Replies
6. Shell Programming and Scripting
Hi,
I've a file in the following format
1999-APR-8 17:31:06 1500 3 45
1999-APR-8 17:31:15 1500 3 45
1999-APR-8 17:31:25 1500 3 45
1999-APR-8 17:31:30 1500 3 45
1999-APR-8 17:31:55 1500 3 45
1999-APR-8 17:32:06 1500 3 ... (1 Reply)
Discussion started by: vaibhavkorde
1 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I am new to unix programming. I am trying for a requirement and the requirement goes like this.....
I have a test folder. Which tracks log files. After certain time, the log file is getting overwritten by another file (randomly as the time interval is not periodic). I need to preserve... (2 Replies)
Discussion started by: mailsara
2 Replies
8. Shell Programming and Scripting
Hi Friends,
I have the following logfile. Currently time in india is 07/31/2014 12:33:34 and i have the following content in logfile. I want to display only those entries which contain string 'Exception' within last 3 hours. In this case, it would be the last line only
I can get the... (12 Replies)
Discussion started by: srkmish
12 Replies
9. Shell Programming and Scripting
Hello ,
I am working on AIX. I have to convert Unix timestamp to normal timestamp. Below is the file. The Unix timestamp will always be preceded by
EFFECTIVE_TIME as first field as shown and there could be multiple EFFECTIVE_TIME in the file : 3.txt
Contents of... (6 Replies)
Discussion started by: rahul2662
6 Replies
10. Shell Programming and Scripting
So basically I have a log file and each line in this log file starts with a timestamp:
MON DD HH:MM:SS
SEP 15 07:30:01
I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies
LEARN ABOUT DEBIAN
mdm.screen
MDM.SCREEN(1) User Commands MDM.SCREEN(1)
NAME
mdm.screen - run a command under mdm-master
SYNOPSIS
mdm.screen [-c iospec] [-n slaves] command
DESCRIPTION
mdm.screen runs command under mdm-master so that mdm-run commands in command can run in parallel.
This program is a part of the Middleman System (mdm).
OPTIONS
The mdm.screen command has two optional options.
-c iospec
The iospec file (see below).
-n slaves
The number of mdm-slave process to start (default 6).
THE IOSPEC FILE
mdm-master uses the iospec file to decide whether two commands interfere with each other, and it only runs two commands at the same time if
they do not interfere.
Each line of the iospec file specifies the I/O behavior of a program, unless the line starts with a '#' character, in which case the line
is treated as comments and ignored. The format is as follows:
program spec spec ...
program names the program whose behavior you are specifying. For each spec element, the first character indicates usage, and the remaining
characters indicate resource.
A resource that starts with a '-' character represents the argument of the corresponding program option. A resource that is an empty
string represents a program argument. A resource that is not empty and does not start with a '-' character represents the resource string
itself.
A usage is typically an upper-case character. If two commands access the same resource with different usage, mdm-master will not run these
two commands at the same time. Furthermore, if a command access a resource with 'W' usage, mdm-master will not run it with any command
that access the same resource in any way (including 'W'). There is a special case: if usage is '0' and resource starts with a '-' charac-
ter, it means that the resource program option does not take any arguments.
All programs has an implicit spec 'Rglobal', so if you mark a program as 'Wglobal', it will not run while any other command is running.
Here is an example to help clarify matters. Suppose we have the following iospec file:
cc W-o 0-c R
rm W
Then these two commands can run at the same time:
cc -o pa pa.o lib.o
cc -o pb pb.o lib.o
These two commands cannot run at the same time:
cc -o pa.o -c pa.c
cc -o pa pa.o lib.o
And these two commands also cannot run at the same time:
cc -o pa pa.o lib.o
rm pa
EXIT STATUS
The exit status of mdm.screen is 0.
EXAMPLE
Here is what you do to decompress all files with .gz extension in the current directory tree.
mdm.screen find . -iname '*.gz' -exec mdm-run gunzip {} ;
Since we run find under mdm.screen and invoking gunzip under mdm-run, we specify that we wish to run the gunzip commands in parallel.
SEE ALSO
mdm-run(1), mdm-sync(1), ncpus(1)
Linux 2009-03-06 MDM.SCREEN(1)