Sponsored Content
Top Forums Shell Programming and Scripting How to get the latest and new values from the file in perl? Post 302444966 by durden_tyler on Friday 13th of August 2010 10:12:53 AM
Old 08-13-2010
Quote:
Originally Posted by vanitham
...
Now the recent contents of the file are:

Code:
StartTimeStamp,EndTimeStamp,Counter1,Counter2,Counter3,Counter4
Aug13 2010 02:49:21,Aug13 2010 02:54:21,9,8,0,0
Aug13 2010 02:59:32,Aug13 2010 03:00:00,0,0,0,0
Aug13 2010 03:00:00,Aug13 2010 03:04:32,9,8,0,0
Aug13 2010 03:07:55,Aug13 2010 03:08:55,0,0,0,0
Aug13 2010 04:07:55,Aug13 2010 04:08:55,1,0,0,0
Aug13 2010 04:10:55,Aug13 2010 04:13:55,2,0,0,0

I have to compare the value before and after run i.e just check the values in file before running and after some process those values get incremented.

I have to compare those values.

How can i do it perl?
...
Your question is not clear.

Let's assume that your file looked like this before the process run -

Code:
StartTimeStamp,EndTimeStamp,Counter1,Counter2,Counter3,Counter4
Aug13 2010 02:49:21,Aug13 2010 02:54:21,9,8,0,0
Aug13 2010 02:59:32,Aug13 2010 03:00:00,0,0,0,0
Aug13 2010 03:00:00,Aug13 2010 03:04:32,9,8,0,0
Aug13 2010 03:07:55,Aug13 2010 03:08:55,0,0,0,0

And it looks like this after the process run -

Code:
StartTimeStamp,EndTimeStamp,Counter1,Counter2,Counter3,Counter4
Aug13 2010 02:49:21,Aug13 2010 02:54:21,9,8,0,0
Aug13 2010 02:59:32,Aug13 2010 03:00:00,0,0,0,0
Aug13 2010 03:00:00,Aug13 2010 03:04:32,9,8,0,0
Aug13 2010 03:07:55,Aug13 2010 03:08:55,0,0,0,0
Aug13 2010 04:07:55,Aug13 2010 04:08:55,1,0,0,0
Aug13 2010 04:10:55,Aug13 2010 04:13:55,2,0,0,0

(1) There were 4 records before the process run. They are in red color.
(2) The process appended 2 new records to the file. They are in blue color.
(3) There are 6 records now, after the process run.

Quote:
I have to compare those values.
How can i do it perl?
What exactly do you want to compare ??
There are 4 + 2 = 6 records in the file. Each record has a bunch of fields.

Why not take the file shown above as your input and show us your expected output ? Please put it within [ code ] tags.

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL:How to convert numeric values txt file to PACKED DECIMAL File?

Is there any way to convert numeric values txt file to PACKED DECIMAL File using PERL. Regards, Alok (1 Reply)
Discussion started by: aloktiwary
1 Replies

2. Shell Programming and Scripting

perl -write values in a file to @array in perl

Hi can anyone suggest me how to write a file containing values,... say 19 20 21 22 .. 40 to an array @array = (19, 20, ... 40) -- Thanks (27 Replies)
Discussion started by: meghana
27 Replies

3. Shell Programming and Scripting

Perl's buffered I/O is causing me to miss latest log file entries in log colorizer. How to fix?

I've been finding myself using a log file colorizer written in perl to reformat and colorize the output from many different programs. Mainly, however, I use it to make the output from "tail -f" commands more readable. The base perl script I use is based on "colorlogs.pl" available from the... (1 Reply)
Discussion started by: rcsteiner
1 Replies

4. Shell Programming and Scripting

Perl matching values in a file

I am trying to match first 5 values of $passt variable in a file $chpdvlst and then verify that value in $grp parameter I want first 5 values which has $vaht - ship and $grp = N-grp. Somehow script below lists whole file. $memcnt = 5; $passt = ship; open (ADVOUT, "< $chpdvlst") || die... (5 Replies)
Discussion started by: dynamax
5 Replies

5. UNIX for Dummies Questions & Answers

extracting values from file using perl

I would like to read value after $ symbol from a file. For eg a file will be having the following lines. 5,$0,-32768p,32767p,$400014f8,1,, 5,$0,0,0,$400008ce,1,, 5,$0,0,0,$400008d0,1,, i would like to read 400014f8 then 400014f8 and similar all the value after $ symbol.Can any one help... (1 Reply)
Discussion started by: jagadeeshrr
1 Replies

6. Shell Programming and Scripting

AWK, Perl or Shell? Unique strings and their maximum values from 3 column data file

I have a file containing data like so: 2012-01-02 GREEN 4 2012-01-02 GREEN 6 2012-01-02 GREEN 7 2012-01-02 BLUE 4 2012-01-02 BLUE 3 2012-01-02 GREEN 4 2012-01-02 RED 4 2012-01-02 RED 8 2012-01-02 GREEN 4 2012-01-02 YELLOW 5 2012-01-02 YELLOW 2 I can't always predict what the... (4 Replies)
Discussion started by: rich@ardz
4 Replies

7. Shell Programming and Scripting

awk, sed or perl regexp to print values from file

Hello all According to the following file (orignal one contains 200x times the same structure...) I was wondering if someone could help me to print <byte>??</byte> values example, running this script/command like ./script.sh xxapp I would expect as output: 102 116 112 ./script.sh xxapp2... (2 Replies)
Discussion started by: cabrao
2 Replies

8. Shell Programming and Scripting

Perl : copying only the latest file to other directory

In linux.. In a directory there are 3 files which I want to copy only the latest file (ls -ltr myfiles*.txt|tail -1) to other directory in perl? Could anyone please help me with the code? Regards, J (1 Reply)
Discussion started by: scriptscript
1 Replies

9. Shell Programming and Scripting

Perl: Writing table values to a file

I have a file like this, 1,a,saurav 2,b,rout I want to show this file in a perl cgi page table and want to add a column which will contain a text box. There I will give some manual input, which will be written to the existing file(or a new file) in below format. 1|a|saurav|bangalore... (2 Replies)
Discussion started by: sauravrout
2 Replies

10. Shell Programming and Scripting

Get multiple values from an xml file using one of the following commands or together awk/perl/script

Hello, I have a requirement to extract the value from multiple xml node and print out the values to new file to compare. Would be done using either awk/perl or some unix script. For example sample input file: ..... ..... <factories xmi:type="resources.jdbc:DataSource"... (2 Replies)
Discussion started by: slbmind
2 Replies
GCHEM3D(1)						       gnome-chemistry-utils							GCHEM3D(1)

NAME
gchem3d - a small chemical viewer application SYNOPSIS
gchem3d [OPTION(S)...] [FILE...] DESCRIPTION
gchem3d is a small chemical viewer application, which can show several chemical file formats. OPTIONS
The following options are accepted: -b COLOR, --bgcolor=COLOR Use the given color as background color. COLOR can be one of "black" (default), "white", "#rrggbb" (don't forget to escape the "#" character in the shell). -d MODEL, --display3d=MODEL Choose how molecules are displayed. MODEL can be one of "BallnStick" (default), "SpaceFill". -?, --help Show application help options. --help-all, --help-* Print all or just a group of help options. These options are not documented here. Instead see gtk-options(7) and gnome-options(7). -v, --version Print gchem3d version information. SEE ALSO
gnome-options(7), gtk-options(7) AUTHORS
Jean Brefort <jean.brefort@normalesup.org> Program author. Daniel Leidert <daniel.leidert@wgdd.de> Manpage author. COPYRIGHT
Copyright (C) 2002-2007 Jean Brefort Copyright (C) 2004-2007 Daniel Leidert Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation. gcu 0.12 $Date: 2009-03-19 10:53:47 +0100 (jeu. 19 mars 2009) $ GCHEM3D(1)
All times are GMT -4. The time now is 03:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy