Sponsored Content
Top Forums Shell Programming and Scripting Getting various parts from the log Post 302951829 by RudiC on Tuesday 11th of August 2015 04:05:59 AM
Old 08-11-2015
Try also
Code:
awk -F- '{split ($1, T, " "); print T[1], $NF}' file
22:16:13.601 SELECT GETDATE()
22:16:13.632 SELECT 1
22:16:13.632 SELECT 1

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cksum parts of a file

Every time we build an executable the date and time are put into the file, I need to run checksum on just the working lines.(IE, no header files) Is this even possible, if so how would I go about it? I am using a HP-UX server any help you can give me will be greatly appreciated. Thanks (6 Replies)
Discussion started by: crazykelso
6 Replies

2. Shell Programming and Scripting

getting parts of a file

Hello, I'm trying to retreive certain bits of info from a file. the file contains a list like this info1:info2:info3:info4 info1:info2:info3:info4 info1:info2:info3:info4 info1:info2:info3:info4 how do i pick out only info2 or only info3 without the others? Thanks (11 Replies)
Discussion started by: bebop1111116
11 Replies

3. Shell Programming and Scripting

extract certain parts from a file

I have a logfile from which i need to extract certain pattern based on the time but the problem here is the time is not same for all days. Input file: Mon 12:34:56 abvjingjgg Mon 12:34:57 ofjhjgjhgh . . . Mon 22:30:00 kkfng . . . Mon 23:12:23 kjgsdafhkljf . . . Tue 01:04:54... (8 Replies)
Discussion started by: gpk_newbie
8 Replies

4. Shell Programming and Scripting

Parts is parts, but all together ...

I understand the individual pieces of the following (with one exception ..), but how does it all work as one? find ${HOME}/reports/ -name surveyresult*.txt -exec ls -1 {} \; | /usr/xpg4/bin/grep -E \ "${HOME}/reports/surveyresult{14,14}.txt" | sort > ${ResultsFileList} Find all files like... (1 Reply)
Discussion started by: jdorn001
1 Replies

5. Shell Programming and Scripting

Extract Parts of File

Hello All, I have a file like this Define schema flat_file_schema ( a varchar(20) ,b varchar(30) ,c varchar(40) ); (Insert into table ( a ,b ,c ) values ( 1 ,2 ,3 ); (4 Replies)
Discussion started by: nnani
4 Replies

6. Shell Programming and Scripting

Combine two parts of a file

Hello All, I have a file like this APPLY ( 'INSERT INTO brdcst_media_cntnt ( cntnt_id ,brdcst_media_cntnt_cd ,cntnt_prvdr_cd ,data_src_type_cd ,cntnt_titl_nm ,cntnt_desc ,batch_dt ,batch_id ) VALUES ( :cntnt_id (3 Replies)
Discussion started by: nnani
3 Replies

7. Shell Programming and Scripting

Incrementing parts of ten digits number by parts

I have number in file which contains date and serial number: 2013101000. The last two digits are serial number (00). So maximum of serial number is 100. After reaching 100 it becomes 00 with incrementing 10 which is day with max 31. after reaching 31 it becomes 00 and increments 10... (31 Replies)
Discussion started by: Natalie
31 Replies

8. Shell Programming and Scripting

Split file into n parts.

Hi all: I have a 5-column tab-separated file. The only thing that I want to do with it is to split it. However, I want to split it with a 80/20 proportion -- randomized, if possible. I know that something like : awk '{print $0 ""> "file" NR}' RS='' input-file will work, but it only... (6 Replies)
Discussion started by: owwow14
6 Replies

9. Shell Programming and Scripting

Parsing a log file to cut off some parts

Dear all, I would like to use SQL's log file to extract information from it. This file can include four different types of instruction with the number of lines involved for each of them: -> (1) "INSERT" instruction with the number of lines inserted -> (2) "UPDATE" instruction with the... (4 Replies)
Discussion started by: dae
4 Replies

10. Shell Programming and Scripting

How to get first four parts of the string?

I have the string: XXXX.YYYY_ZZZ.20180724.01.txt I need to get rid of .txt and get full four parts XXXX.YYYY_ZZZ.20180724.01 I did: CTL=`echo XXXX.YYYY_ZZZ.20180724.01.txt | rev | cut -d"." -f4 | rev` But got only YYYY_ZZZ What should I do to get all four parts of that... (4 Replies)
Discussion started by: digioleg54
4 Replies
CISCO_IOS2DLF.IN(1)					  LogReport's Lire Documentation				       CISCO_IOS2DLF.IN(1)

NAME
cisco_ios2dlf - convert cisco logs to dlf format SYNOPSIS
cisco_ios2dlf DESCRIPTION
This script expects syslog-type logs from a CISCO IOS router on stdin. These look like e.g. Jul 3 00:00:39 router 40108: 4d09h: %SEC-6-IPACCESSLOGP: list FR_VA_in permitted udp 192.168.19.1(137) (Serial0/0.2 DLCI 120) -> 192.168.19.255(137), 2 packets Jul 3 00:02:39 router 40109: 4d09h: %SEC-6-IPACCESSLOGP: list FR_VA_in permitted udp 192.168.80.42(138) (Serial0/0.2 DLCI 120) -> 192.60.60.148(138), 1 packet Jul 3 00:02:39 router 40110: 4d09h: %SEC-6-IPACCESSLOGDP: list FR_VA_in permitted icmp 192.168.80.82 (Serial0/0.2 DLCI 120) -> 149.1.1.1 (8/0), 1 packet or Aug 19 04:02:34 gateway.foo.bar 218963: Aug 19 04:02:32.977: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0:1, changed state to down Aug 19 04:02:34 gateway.foo.bar 218964: Aug 19 04:02:33.262: %ISDN-6-DISCONNECT: Interface BRI0:1 disconnected from 172605440 acme, call lasted 42 seconds Aug 19 04:02:35 gateway.foo.bar 218965: Aug 19 04:02:33.266: %LINK-3-UPDOWN: Interface BRI0:1, changed state to down Aug 19 04:02:38 gateway.foo.bar 218966: Aug 19 04:02:36.103: %SEC-6-IPACCESSLOGP: list 102 denied tcp 100.198.139.148(4652) -> 100.193.176.49(80), 1 packet Aug 19 04:02:45 gateway.foo.bar 218967: Aug 19 04:02:43.543: %ISDN-6-LAYER2DOWN: Layer 2 for Interface BR0, TEI 86 changed to down Aug 19 04:02:53 gateway.foo.bar 218968: Aug 19 04:02:51.471: %SEC-6-IPACCESSLOGP: list 102 denied tcp 100.74.103.1(2162) -> 100.193.176.98(80), 1 packet The outputted dlf files look like: 994118619 permitted icmp 192.168.80.9 - Serial0/0.2 DLCI_120 192.168.19.1 - 1 994118619 permitted udp 192.168.19.1 138 Serial0/0.2 DLCI_120 192.168.19.255 138 1 EXAMPLES
To process a log as produced by Cisco IOS: $ cisco_ios2dlf < cisco.log cisco_ios2dlf will be rarely used on its own, but is more likely called by lr_log2report: $ lr_log2report cisco_ios < /var/log/cisco.log AUTHORS
Francis J. Lacoste based on initial code by Joost Bekkers <joost@jodocus.org> VERSION
$Id: cisco_ios2dlf.in,v 1.8 2006/07/23 13:16:35 vanbaal Exp $ COPYRIGHT
Copyright (C) 2001 Joost Bekkers <joost@jodocus.org> Copyright (C) 2002 Stichting LogReport Foundation <logreport@logreport.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. Lire 2.1.1 2006-07-23 CISCO_IOS2DLF.IN(1)
All times are GMT -4. The time now is 02:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy