04-22-2006
Quote:
Originally Posted by marcus121
I love awk and understand all of the above up to your post, vgersh99. I don't understand what assigning the first field to itself (i.e. $1=$1) or number of fields to itself ($NF=$NF) does. Please broaden my horizon.
it forces awk to reevaluate the current record. As we're changing OFS, result of the reevaluation is the same record with new OFS.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a data file that is arranged like this:
Marketing Ranjit Singh Eagles Dean Johnson FULL
Marketing Ken Whillans Eagles Karen Thompson FULL
Sales Peter RobertsonGolden TigersRich Gardener PART
President Sandeep Jain Wimps Ken Whillans CONT... (7 Replies)
Discussion started by: hitman247m
7 Replies
2. Shell Programming and Scripting
hi everyone,
I am looking for an easy way to extract columns from a text file based on a regular expression, kind of like grep but searching and returning columns instead.
for example, suppose i have the following file, 'file.txt':
A B C D B
1 2 3 4 5
6 7 8 9 0
5 6 7 8 9
2 3 8 9 0
I... (6 Replies)
Discussion started by: css136
6 Replies
3. Shell Programming and Scripting
Hi,
I need to perform a grep from a file, but ignore any results from the first column.
For simplicity I have changed the actual data, but for arguments sake, I have a file that reads:
MONACO Monaco ASMonaco
MANUTD ManUtd ManchesterUnited
NEWCAS NewcastleUnited
NAC000 NAC ... (5 Replies)
Discussion started by: danhodges99
5 Replies
4. Shell Programming and Scripting
please help,
file1.txt
id,week,ict,outgoing_call,blackberry_problem,gprs_problem,sms_problem,flash_problem,sinyal_lemah,blankspot,incoming_call,mms_problem,kualitas_suara,drop_call,data_probl
em,cross_connect,connect_no_voice,vas_problem
,1,sumbagsel,96,127,52,70,28,29,21,18,18,8,5,3,0,0,3... (1 Reply)
Discussion started by: radius
1 Replies
5. Shell Programming and Scripting
Hi have a large spreadsheet which has 4 columns
APM00111803814 server_2 96085 Corp IT Desktop and Apps
APM00111803814 server_2 96085 Corp IT Desktop and Apps
APM00111803814 server_2 96034 Storage Mgmt Team
APM00111803814 server_2 96152 GWP... (6 Replies)
Discussion started by: kieranfoley
6 Replies
6. UNIX for Dummies Questions & Answers
Trying to do a grep -v on a value in the 2nd column of text. So if the word apple appears in a line in the 2nd column, it would not show up when the file was cat. Seems like a simple enough operation but I just can't figure it out. Any help would be appreciated. Thanks in advance.
Are apples... (4 Replies)
Discussion started by: jimmyf
4 Replies
7. Shell Programming and Scripting
PROL\tests_li004_developers:VAS:3543346:q34243,d3hs35,34bdf3,24sfgg,a3s234
Im trying to grep all text after VAS:3543346, so im trying to just have this
q34243,d3hs35,34bdf3,24sfgg,a3s234
Im confused on how I would do this (7 Replies)
Discussion started by: ajetangay
7 Replies
8. Shell Programming and Scripting
Hello All
I have an input file with data below. I would like to grep and display the data where 3rd column contains string or at least one character. Kindly please help me with this!
Input:
tjfa3|zznpou|224fdd.34.ff3.35 |Tiv|Otj|1
fgduul7|zznikj| ... (7 Replies)
Discussion started by: DoveLu
7 Replies
9. UNIX for Beginners Questions & Answers
I have a file with two columns separated by white space.
Dog Cat
fido sneaky
dopey poptart
ears whisker
barky herd
Trying to list the words under the column named Dog. Tried a few variations of awk but can't... (4 Replies)
Discussion started by: jimmyf
4 Replies
10. Shell Programming and Scripting
Gents
Is it possible to update the code to get the desired output files from the input list. I called variable to the first column.
I need to consider the first column as key to grep the values in the second column according to the desired request.
input list
(attached )
output1
... (12 Replies)
Discussion started by: jiam912
12 Replies
LEARN ABOUT DEBIAN
cisco_ios2dlf
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)