Sponsored Content
Top Forums Shell Programming and Scripting Help with pulling / filtering data from a .csv Post 302452172 by durden_tyler on Thursday 9th of September 2010 12:54:43 PM
Old 09-09-2010
Code:
$
$
$ cat f12
hostA,invver,1.02,20100430
hostA,date,08/30/2010,06:18
hostA,use,"Unknown Server Use"
hostA,os,"5.2.0.0","5200-10-04-0750","IBM,7029-6C3","0004DBAC4C00"
hostA,obp,Sat Aug 28 20:34:22 2010
hostA,mem,2048 MB
hostA,platform,IBM,7029-6C3
hostA,serial,"104DBAC"
hostA,hostid,"0xcfc0213b"
hostB,invver,1.05,20100526
hostB,date,08/30/2010,06:18
hostB,use,"unknown-server"
hostB,os,"5.10","142900-12","sun4u","SUNW,SPARC-Enterprise"
hostB,obp,"4.24.11"
hostB,mem,65536
hostB,platform,"Sun Microsystems sun4u Sun SPARC Enterprise M5000 Server"
hostB,serial,"BEF0949C7D"
hostB,hostid,"854574e2"
hostC,platform,"Solaris Server"
hostC,serial,"XXX9999Y9Z"
hostC,hostid,"123456x7"
hostD,platform,"sun microsystems server"
hostD,serial,"YYY8888Y8Z"
hostD,hostid,"555555x5"
$
$ # I've made the assumption that "platform", "serial" and "hostid" occur in that order (in different lines) for Sun servers in your file.
$ # They do not have to be on consecutive lines for this script to work.
$
$ awk -F, '/platform.*[Ss]un/{print $1":", $3; x=1}; /serial/ && x==1{print $0}; /hostid/ && x==1{print $0; x=0}' f12
hostB: "Sun Microsystems sun4u Sun SPARC Enterprise M5000 Server"
hostB,serial,"BEF0949C7D"
hostB,hostid,"854574e2"
hostD: "sun microsystems server"
hostD,serial,"YYY8888Y8Z"
hostD,hostid,"555555x5"
$
$

tyler_durden

Last edited by durden_tyler; 09-09-2010 at 02:21 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pulling data and following lines from file

I saw a few posts close to what i want to do, but they didn't look like they would work exactly.. or I need to think out of the box on this. I have a file that I keep server stats in for my own performance analysis. this file has the output from many commands in it (uptime, vmstats, ps, swap... (2 Replies)
Discussion started by: MizzGail
2 Replies

2. Shell Programming and Scripting

SFTP to server, pulling data and removing the data

Hi all, I have the following script, but are not too sure about the syntax to complete the script. In essence, the script must connect to a SFTP server at a client site with username and password located in a file on my server. Then change to the appropriate directory. Pull the data to the... (1 Reply)
Discussion started by: codenjanod
1 Replies

3. Shell Programming and Scripting

pulling different fields from a csv file

Hi, I have a requirment where I need to pull different columns from a .csv file. Here is the sample of the csv file. account,item,flag1,flag2,flag3,flag4,flag5,......feed,tran I will be have a config.txt file which will have the following information. item,flag5,flag10,feed,tran... (2 Replies)
Discussion started by: akdevula
2 Replies

4. Shell Programming and Scripting

Reading 2 CSV files and filtering data based on group

I have two CSV files in the following format: First file: GroupID, PID:TID, IP, Port Sample data: 0,1000:11,127.0.0.1,445 0,-1:-1,127.0.0.1,800 1,1000:11,127.0.0.1,445 1,-1:-1,127.0.0.1,900 2,1000:11,127.0.0.1,445 2,-1:-1,180.0.0.3,900 Second file: IP,Port,PID Sample data... (6 Replies)
Discussion started by: rakesh_arxmind
6 Replies

5. Shell Programming and Scripting

Pulling data from xml

Hi there, Please could anyone help with this. I have an xml file that contains repeating values eg <Rule name> AAAAA <Action> BBBBB </Action> <Data> CCCCC </Data> <Type> DDDDD </Type> </Rule name> <Rule name> A1A1A1A1 <Action> B1B1B1B1 </Action> <Data> C1C1C1C </Data> <Type>... (4 Replies)
Discussion started by: ssideel
4 Replies

6. Shell Programming and Scripting

Filtering data from text to csv

Hello, Is there a way to filerter data from a text file as shown below to a Column e.g. hostname nfsmount as two separate column. Currently I could get hostname and the mount is appearing below.. using this script #! /bin/bash for i in `cat fqdn.txt` do echo "$i ............ " >>... (3 Replies)
Discussion started by: Cy Pqa
3 Replies

7. Shell Programming and Scripting

BASH- Need help pulling data from .emlx

Hello, fellow computer junkies. First time poster! My boss wrote an application (Mavericks 10.9, Mountain Lion 10.8) that checks a user's security settings. The user runs the application, then it spits out an email that is sent back to our inbox showing the results. On our end, we have a mail rule... (5 Replies)
Discussion started by: sudo
5 Replies

8. Shell Programming and Scripting

Pulling Data, Then Moving to the Next File

I'm scanning a list of emails- I need to pull 2 pieces of data, then move to the next file: Sender's Email Address Email Date I need these to be outputted into a single column- separated by a ",". Like this: Email1's Address, Email1's Date Stamp Email2's Address, Email2's Date Stamp... (4 Replies)
Discussion started by: sudo
4 Replies

9. Shell Programming and Scripting

Need help with csv filtering

Hello everyone, i am stuck with a task i was meant to do so i came here. So i have a .csv file which structure is : year;temperature;precipitation 2012;32;483 2006;28;517 ... I want to note that it is in fact ";" not a space, which a new file named <old-name>-new.txt, the first line must ... (2 Replies)
Discussion started by: Needhelp123
2 Replies
tttprobe(1)								net							       tttprobe(1)

NAME
tttprobe - Tele Traffic Tapper probe - A probe to collect local traffic-data and send it to a remote instance of tttview SYNTAX
ttt [-interface device] [-interval ms] [-multicast] [-port dest_port] [-ttl time-to-live] [Destination] DESCRIPTION
tttprobe is the probe program in the ttt program suite. tttprobe locally collects traffic-data and sends it over a network to an instance of tttview. To run tttview, it is not necessary to be "root". The ttt program suite is yet another descendant of tcpdump but it is capable of real-time, graphical, local and remote traffic-monitoring. It won't replace tcpdump, rather, it helps you find out what to look into with tcpdump. OPTIONS
ttt [-interface device] [-interval ms] [-multicast] [-port dest_port] [-ttl time-to-live] [Destination] -interface device specifies the interface for packet capture. If not specified, the default interface is chosen. -interval ms Sets the interval in Milliseconds. If omitted, a interval of 1000 msec. is used as default. -multicast Shorthand for the default multicast destination "224.8.8.0". -port dest_port Specifies the udp port number on the remote host where the traffic-data should be sent to. If omitted, port 7288 is used as default. -ttl time-to-live Specifies the time-to-live for multicast. If omitted, 1 is used as default to restrict the multicast to the local subnet. Destination Specifies the remote host where the traffic-data should be sent to. Destination can be omitted only, if -multicast is specified. Destination can be a uni- or multicast address. EXAMPLES
Remark: "hostA" is allways the host where traffic-data is collected with tttprobe and "hostB" is allways the host where the traffic-data is displayed with tttview. point-to-point monitoring: hostA: tttprobe hostB hostB: tttview or: hostA: tttprobe ip_of_hostB hostB: tttview multicast: when using the default multicast address: hostA: tttprobe -multicast hostB: tttview -multicast this is equivalent to: hostA: tttprobe 224.8.8.0 hostB: tttview -addr 224.8.8.0 AUTHORS
tttprobe was written by Kenjiro Cho < kjc@csl.sony.co.jp>. This manual page was written by Thomas Scheffczyk <thomas.scheffczyk@verwaltung.uni-mainz.de>, for the Debian GNU/Linux system (but may be used by others). SEE ALSO
ttt(1), tttview(1) Kenjiro Cho 1.7 tttprobe(1)
All times are GMT -4. The time now is 08:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy