Sponsored Content
Top Forums Shell Programming and Scripting help to retrive data from log file Post 302078658 by Hitori on Monday 3rd of July 2006 04:51:55 PM
Old 07-03-2006
perl

Implying that dates were written in same format:

Code:
$ cat 1.pl
#!/usr/bin/perl -w

open (INPUT, "< logfile");

my $last = '', @to_print = ();
while (<INPUT>) {

    push @to_print, $_;
    if (/^\*{3}/) {
        s/\*//g;
        @to_print = ($to_print[$#to_print]) if $last ne $_;
        $last = $_;
    }
}

for (@to_print) {
    print $_;
}

Code:
$ cat logfile
*****************Thu Jun 28 20:06:28 BST 2006**************************************
Generation Number : 20062231
Generation Date : 20060629
There are no detail records
*****************Thu Jun 29 23:46:38 BST 2006**************************************
Generation Number : 20062231
Generation Date : 20060629
There are no detail records
*****************Fri Jun 30 00:01:19 BST 2006**************************************
Generation Number : 20062237
Generation Date : 20060629
There are no detail records
*****************Fri Jun 30 00:01:19 BST 2006**************************************
Generation Number : 20062237
Generation Date : 20060630
There are no detail records

Code:
$ ./1.pl
*****************Fri Jun 30 00:01:19 BST 2006**************************************
Generation Number : 20062237
Generation Date : 20060629
There are no detail records
*****************Fri Jun 30 00:01:19 BST 2006**************************************
Generation Number : 20062237
Generation Date : 20060630
There are no detail records

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Retrive deleted file's info

I have shell script which reads files, stores its data into Oracle and then deletes tht file. now i want to know creation date and time of deleted files. can we do this? if yes then how? (4 Replies)
Discussion started by: asmita
4 Replies

2. Shell Programming and Scripting

to retrive data that appear only once in a file.

hi, I need to get the list of functions that are used more than once in a file list. Thanks in advance (1 Reply)
Discussion started by: anibu
1 Replies

3. Shell Programming and Scripting

retrive lines from a file using AWK command

Dear friends, please tell me how to get some required lines from a file and write to another file using AWK command. i.e., if a file contains, abcdefghigk 12345 lmnopqrstuv 678910 wxyz please tell me how to get lines(line count is always 2 and it's contineous) mentioned in blue... (1 Reply)
Discussion started by: swamymns
1 Replies

4. Shell Programming and Scripting

retrive value from a file

hi i am new to shell scripting i have a properties file like hs=abc hs1=def hs2=ghi now i want to retrive each value and assign it to a variable like var1 = abc please help (7 Replies)
Discussion started by: satish@123
7 Replies

5. Shell Programming and Scripting

Retrive the value returned by a command excuted in a remote server using ssh

Hello Everybody, I'm facing a weird problem with the awk command. I try to retrieve in a variable the value returned by a simple ls command. ls /export/home/tmp |tail -1 return a good value (the name of the . But When I try to execute the same command in a remote server using ssh as... (2 Replies)
Discussion started by: Jabarod
2 Replies

6. Shell Programming and Scripting

Range of data from a log file .

I am having a log file in which i need a range of data from specific date range. $cat my.log Jan 07 15:39:03 N/A _M_LocalDirectory listFiles(): listing files from dir Jan 07 15:39:03 N/A _w_fm_log:_f_Push() _w_fm_log_export_ftppush(): Files f Jan 07 05:58:35 N/A _w_fm_log_autoexport ... (6 Replies)
Discussion started by: posix
6 Replies

7. UNIX for Dummies Questions & Answers

make ls retrive ordered list of elements

Hello friends!! I have a question regarding the use of ls in unix. I have a folder with files: t1.txt t2.txt t3.txt t4.txt ... t10.txt When I make an ls I always get: t10.txt t1.txt t2.txt t3.txt .. t9.txt (2 Replies)
Discussion started by: SaktiPhoenix
2 Replies

8. UNIX for Dummies Questions & Answers

How to retrive data from DB(Aqua studio) in CVS format using UNIX script?

I am using aqua studio DB. I need to retrive the data from my database using uxin script in .csv format. i am using select query along with the joins. my o/p in the DB is of the below format. Cycle IDCycle StatusRecord 98N-0000ACV23-3636FCliet Level (Af)Success1689393HF-J7879-09090RCliet Level... (1 Reply)
Discussion started by: Mugivz
1 Replies

9. Shell Programming and Scripting

Data sorting out from log file

I have a logfile looks like this: Received request of type I need two write out every line to a new file if contains to a file called the SID name, like 187175558_xyz.txt Thanks for helping! ---------- Post updated at 08:11 AM ---------- Previous update was at 08:10 AM ---------- I... (7 Replies)
Discussion started by: batka
7 Replies

10. Shell Programming and Scripting

Extract data from a log file and put it in a file

Hi, I would like to seek your help for a script that will extract data from log file and put it in a file. Sample log file 2018-10-23 12:33:21 AI ERROR -- tpid: SAMPLE_TH account: 123456789 aiSessionNumber: 660640464 mapName: xxx to yyy errorDesc: Translation Error:ErrorNumber : 993 ... (2 Replies)
Discussion started by: neverwinter112
2 Replies
ne(4)							     Kernel Interfaces Manual							     ne(4)

Name
       ne - Second Generation Ethernet Chip Interface

Syntax
       device ne0 at ibus? vector neintr

Description
       The interface provides access to a 10 Mb/s Ethernet network through the Digital's Second Generation Ethernet Chip (SGEC) based controller.

       The  host's  Internet  address  is specified at boot time with an SIOCSIFADDR ioctl.  The interface employs the address resolution protocol
       described in to map dynamically between Internet and Ethernet addresses on the local network.

       The driver normally tries to use a trailer encapsulation to minimize copying data on input and output.  This can be disabled for an  inter-
       face by setting the IFF_NOTRAILERS flag with an SIOCSIFFLAGS ioctl.  Trailers are only used for packets destined for Internet hosts.

       The SIOCSPHYSADDR ioctl can be used to change the physical address of the adapter and the SIOCRPHYSADDR ioctl can be used to read its phys-
       ical address.

       The SIOCADDMULTI and SIOCDELMULTI ioctls can be used to add or delete multicast addresses.   The  recognizes  a	maximum  of  16  multicast
       addresses.

       The SIOCRDCTRS and SIOCRDZCTRS ioctls can be used to read or read and clear the Ethernet driver counters.  The argument to these two ioctls
       is a pointer to a counter structure, found in

       The SIOCENABLBACK and SIOCDISABLBACK ioctls can be used to enable and disable the interface loopback mode respectively.

Diagnostics
       The diagnostic error messages contain relevant information provided by the driver. For example,

       ne%d: self test failed <reason lists>
       Adapter did not pass the power-up self-test during autoconfiguration time.

       ne%d: write CSR0 failed
       The driver was unable to set the initial value for the adapter.

       ne%d: couldn't allocate ......
       The driver was unable to allocate memory for the internal data structures.  ne%d: can't handle af%d
       The interface was handed a message with addresses formated in an unsuitable address family, and the packet was dropped.

       ne%d: memory error (MERR)
       A host memory problem or a memory parity error has occurred.

       ne%d: SIOCADDMULTI fail, multicast list full
       Too many multicast requests have been made.

See Also
       arp(4p), inet(4f), intro(4n)

																	     ne(4)
All times are GMT -4. The time now is 02:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy