Build Stats out of output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Build Stats out of output
# 1  
Old 02-23-2011
Build Stats out of output

Hi,

I am required to build up a stats out of returned output. Something like given below. I would like first string in first column with a heading, and so on.

Is there any way I could do it, while adding something after the command, or any other way.

Code:
bash-2.05$ grep -i "nsslapd-accesslog*" /apps/EIS/dir/slapd-*/config/dse.ldif
/apps/EIS/dir/slapd-ED-DataDir/config/dse.ldif:nsslapd-accesslog-logging-enabled: on
/apps/EIS/dir/slapd-ED-DataDir/config/dse.ldif:nsslapd-accesslog: /export/apps/EIS/dir/slapd-ED-DataDir/logs/access
/apps/EIS/dir/slapd-ED-DataDir/config/dse.ldif:nsslapd-accesslog-maxlogsperdir: 10
/apps/EIS/dir/slapd-ED-DataDir/config/dse.ldif:nsslapd-accesslog-maxlogsize: 100
/apps/EIS/dir/slapd-ED-DataDir/config/dse.ldif:nsslapd-accesslog-logrotationtime: 1
/apps/EIS/dir/slapd-ED-DataDir/config/dse.ldif:nsslapd-accesslog-logrotationtimeunit: day
/apps/EIS/dir/slapd-ED-MV/config/dse.ldif:nsslapd-accesslog-logging-enabled: on

Code:
 Path	Attribute	Value
/apps/EIS/dir/slapd-ED-DataDir/config/dse.ldif	nsslapd-accesslog-logging-enabled	on

Thanks, John
# 2  
Old 02-23-2011
something along these lines...
play with the 'fmt' formating to line up your headers:
Code:
nawk -F: 'BEGIN{fmt="%-50s%-40s%-10s\n";printf(fmt,"Path","Attribute","Value")}tolower($2)~"nsslapd-accesslog*" {printf(fmt,$1,$2,$3)}'  /apps/EIS/dir/slapd-*/config/dse.ldif

# 3  
Old 02-24-2011
It is just giving me the header, no output.

Code:
bash-2.05$ nawk -F: 'BEGIN{fmt="%-50s%-40s%-10s\n"; printf(fmt,"Path","Attribute","Value")}tolower($2)~"nsslapd-accesslog*" {printf(fmt,$1,$2,$3)}' /apps/EIS/dir/slapd-ED/config/dse.ldif
Path                                              Attribute                               Value

---------- Post updated at 08:50 AM ---------- Previous update was at 08:49 AM ----------

The above one was specific to one folder, this is the one which you suggested.

Code:
bash-2.05$ nawk -F: 'BEGIN{fmt="%-50s%-40s%-10s\n"; printf(fmt,"Path","Attribute","Value")}tolower($2)~"nsslapd-accesslog*" {printf(fmt,$1,$2,$3)}' /apps/EIS/dir/slapd-ED/config/dse.ldif
Path                                              Attribute                               Value

# 4  
Old 02-24-2011
There're no 'folders' in *NIX - only directories.
  1. You have to specify files as input to awk - not a directory
  2. Do the files specified have 'nsslapd-accesslog' as part of the second field?
# 5  
Old 02-24-2011
yes, dse.ldif file is indeed a file, and it contains the search string 'nsslapd-accesslog'
# 6  
Old 02-24-2011
Quote:
Originally Posted by john_prince
yes, dse.ldif file is indeed a file, and it contains the search string 'nsslapd-accesslog'
please post a sample set of records from the file.
# 7  
Old 02-24-2011
Here is the content that i want pull up :

Code:
nsslapd-accesslog-logging-enabled: on
nsslapd-accesslog: /export/apps/EIS/dir/slapd-ED/logs/access
nsslapd-accesslog-maxlogsperdir: 10
nsslapd-accesslog-maxlogsize: 100
nsslapd-accesslog-logrotationtime: 1
nsslapd-accesslog-logrotationtimeunit: day

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

(VS 2008) New build config looking files from other folder build config

Hi Team, My new build configuration always looking for the files from the build where i copied from. please help me to resolve this. I am using Visual studio 2008.It has Qt 4.8. plugins,qml,C++ development I created new debug_new build configuration with additional preprocessor from the... (1 Reply)
Discussion started by: SA_Palani
1 Replies

2. Shell Programming and Scripting

Build.xml invocation by Build Script

Hi I have a build.xml file and I can run it on Windows via cmd. Now I want to write a script to invoke the same. Is there a way to do this? (1 Reply)
Discussion started by: ankur328
1 Replies

3. UNIX for Dummies Questions & Answers

Adding SDK Build on Kernel Source Build

Hi, So I downloaded this kernel source and was able to build it successfully. But I want to add this SDK source code inside, can anyone help me how to do this? Note that the SDK source can be built by itself. I added the SDK in the main Makefile: init-y := init/ #added SDK... (0 Replies)
Discussion started by: h0ujun
0 Replies

4. Linux

Stats on subdirectories

Please help me with a shell script to get the stats on many subdirectories (sub1), (sub2) etc under a mother directory (big) /big | |_______sub1 |_______sub2 |_______sub3 --------- I want to know 1. What is the last file accessed in each subdirectory with date and by whom 2.... (2 Replies)
Discussion started by: digipak
2 Replies

5. Shell Programming and Scripting

Using Stats in Php

So, I have a php program that i need to delete ALL files in a directory that are older than a certain age. <?php /* Get file stat */ $stat = stat('/apps/security/ajaba'); This is as far as I've been able to get. I know in shell programming you can easily do something like this. but I'm... (2 Replies)
Discussion started by: SkySmart
2 Replies

6. UNIX for Advanced & Expert Users

vmstat's cpu stats on first line of output are always the same

Hello, I'm seeing this problem with vmstat, where the first line of output always has the same CPU statistics. For example: neked@nekedmachine:~$ date && vmstat Fri Jul 24 06:57:08 EDT 2009 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd ... (0 Replies)
Discussion started by: neked
0 Replies

7. AIX

IO Stats

Aix 5.3 I am trying to view the IO stats. I do the sar 5 5 but that is the WIO and si different than the IO stats right? I am just blanking on this. I know there is a command that I used to run that brings up a whole bunch of live stats that run live such as mem and so on just can't rememeber... (4 Replies)
Discussion started by: rocker40
4 Replies

8. AIX

system stats

I recieved this out put below soemhow. Unfortunatly I did not write down the command I used to get it. Can someone tell me what command I use to gather these stats? OS = AIX 5.3 64Bit System Model: IBM,7026-6H1 Machine Serial Number:... (2 Replies)
Discussion started by: rocker40
2 Replies

9. UNIX for Advanced & Expert Users

I/O Stats Metrics

What do others use for measuring I/O statistics? I'd like something versatile, as in being able to watch (like iostat, but easier to trend), generate load (like iozone, but more realistic), and perform somewhat generalized benchmarks (like bonnie, but more current.) It would scale from a few... (0 Replies)
Discussion started by: LivinFree
0 Replies
Login or Register to Ask a Question