I have a file which contains 2 days logs(here it is 24 and 25)
I want to list data only for date 25 fron the file.
please suggest me how should i get this.
I deliberately did not use more succinct ways of doing this so you can easily see the logic. The flag can change only when the input line has the string "Name" in it.
not able to understand below line.
what is ok =0 means here
It explicitely defines the ok variable to 0 before any input is read (which wouldn't be necessary as awk allocates variables on first reference and initializes to zero or empty)
Quote:
hi jim,
also getting error while running it .
error
Please DON'T modify proposals given unless you exactly know what you are doing. E.g. you can't use shell variables (DT) inside awkscripts. Use e.g. -vDT="$DT" (or other mechanisms). And, you supply TWO input streams to awk: one from the - useless - cat pipe, and one from "infile" (which I presume doesn't exist on your system and thus is empty). awk uses the latter if provided. And, don't condense multiline scripts into one-liners without taking care of the necessary adaptions.
That said, jim mcnamara's proposal actually has a problem. Try this corrected version:
Run as given first, check for errors, and then only try to adapt to your needs.
---------- Post updated at 05:50 PM ---------- Previous update was at 01:04 PM ----------
please help me in this
It is hard to follow what you are doing. You say that you have one file with two names (vsy.txt.0 and vsy.txt.1) and that this file is updated every 10 seconds.
Is one of these files a symbolic link pointing to the other file? Are both files hard linked? If it is one file, why does it matter to your script which name is used?
How is the file being updated? Are the contents overwritten every 10 seconds? Is text appended to your file every 10 seconds?
If you just want a count of records added every hour and text is being appended to your file, why not just wait until the next day after all of the updates have been received and process your file once?
If you don't give us a clear description of what your computing environment is, what input file(s) you have, the format of that file (or those files) is, the format of the output you want, and sample input files and corresponding sample output that want to extract that the sample input, there is little incentive for the volunteers reading your post to try to guess at what you are trying to do and guess at something the stands very little chance of actually meeting your unspecified requirements.
With what you have told us, why doesn't running the code RudiC suggested every 10 seconds after your file has been updated give the the results you want until the day is done?
Hi,
I am new to scripting. I have a log file and need to fetch specific logs and copy to another file.
A copy of the log is like this:
===============================================================
= JOB : server123#jobs1.jobstream1
= USER : andyc
= Tue 08/01/17... (3 Replies)
Hello, How All are Doing today. I have a issue, I have a file which contains the data as follow
<ENVELOPE><ENVELOPE_ID>TEST</ENVELOPE_ID><ENVELOPE_EXTERNAL_ID></ENVELOPE_EXTERNAL_ID><ENVELOPE_VERSION>2</ENVELOPE_VERSION><SIResourceDefaultVersion>true</SIResourceDefaultVersion><TYPE>GS... (1 Reply)
Hi all,
I have 2 files, One file contain data like this
FHIT
CS
CHRM1
PDE3A
PDE3B
HSP90AA1
PTK2
HTR1A
ESR1
PARP1
PLA2G1B
These names are mentioned in the second file(Please see attached second file) as (7 Replies)
Hi all,
I have 2 files, One file contain data like this
FHIT
CS
CHRM1
PDE3A
PDE3B
HSP90AA1
PTK2
HTR1A
ESR1
PARP1
PLA2G1B
These names are mentioned in the second file(Please see attached second file) as
# Drug_Target_X_Gene_Name:(Where X can be any number (1-1000) (1 Reply)
Hi All,
I m new to this forum & UNix too.
currently i have a requirement which can fetch data from a logfile between two dates or timestamp.
for example:
1. data from 2012 Jun to 2012 Jul
2. data from 2012 Jun to 2012 Jul 07
3. data from 2012 Jun 16 10:20 to 2012 Jul 03 10:10
Please... (7 Replies)
Hi,
I got a requirement to fetch data between two time stamps in a big log file and grep for a word in that particular time interval of data.
Here is my log looks like:
2012/04/08-14:35:56 Abcdefg
2012/04/08-14:35:56 Hijklmnophhoishfw
2012/04/08-14:35:56... (1 Reply)
Hi
i have a file which have a pattern like this
Nov 10 session closed
Nov 10 Nov 9 08:14:27 EST5EDT 2010 on tty .
Nov 10 Oct 19 02:14:21 EST5EDT 2010 on pts/tk .
Nov 10 afrtetryytr
Nov 10 session closed
Nov 10 Nov 10 03:21:04 EST5EDT 2010
Dec 8 Nov 10 05:03:02 EST5EDT 2010
... (13 Replies)
Hi,
I have text file in the following strucher .
The files contain hondreds of lines.
value1;value2;value3;value4
I would like to get back the line with lowest date (values4 field).
In this case its line number 3.
groupa;Listener;1;20110120162018
groupb;Database;0;20110201122641... (4 Replies)
Hi All,
I have a file like this,(This is a sql output file)
cat query_file
200000029
12345 10001
0.2 0
I want to fetch the values 200000029,10001,0.2 .I tried using the below code but i could get... (2 Replies)
I want to fetch passwords from a common file xxxx.txt and use it in a script.
Currently the password is hardcoded so this have to be changed so that password can be fetched from text file.....
Please reply asap..
Thanks (4 Replies)