Sponsored Content
Top Forums Shell Programming and Scripting Bash: create a report with grep output? Post 302484320 by alan on Thursday 30th of December 2010 02:53:59 PM
Old 12-30-2010
Bash: create a report with grep output?

Greetings.

I need to generate a simple report via Bash (Korn?) with this raw data

Code:
    Test_Version=V2.5.2
    Test_Version=V2.6.3
    Test_Version=V2.4.7
    Test_Version=V2.5.2
    Test_Version=V2.5.2
    Test_Version=V2.5.1
    Test_Version=V2.5.0
    Test_Version=V2.3.9
    Test_Version=V2.3.1

Ideally, I'd like to get something like this sorted output

Code:
Version    Count
    ...
    V2.5.0     1
    V2.5.1     1
    V2.5.2     3
    V2.6.3     1
    ...

I can sort the output like this (raw data is contained in ASCII files):

Code:
    find . -name "*.VER" -exec grep "Test_Version" '{}' ';' -print | grep -e "Test_Version" | sort -u

But I can't figure out how to count my records in a tabular layout. Any idea how could I do that?

Thanks!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help with awk to create report

Hi, I am trying to create a report using the following syntax: #!/bin/awk -f #script name: users_report BEGIN { FS=":" ; OFS="\t" ; print "User\tGID\tUser Name\tHome Dir\t" { print $1 , $3 , $5 , $6 } END { print "\n End of Report \n" } $> user_report /etc/passwd the output of... (5 Replies)
Discussion started by: ghazi
5 Replies

2. Shell Programming and Scripting

create a report using shell

hi suppose I want to create a report where it will shows the machine name, the date & time when the report is produced. can anyone please help me to write such shell script? requesting all. Thanks (10 Replies)
Discussion started by: moco
10 Replies

3. Shell Programming and Scripting

using todays date to create a report using grep

What i'm trying to do is to use grep to search through a few files for a selected daemon and only report on today's date. I think I got it sorted apart from in the txt file the date has 2 gaps between the month and the day, and the way I have the date format only puts in one gap any help to get... (3 Replies)
Discussion started by: MBN
3 Replies

4. Programming

How to create this on bash?

I'm trying to create a script with the ff array array 1 - foo@fee.com,fee@fee.com,fyii@fee.com (1 line) array 2 - paul what I want is to have the ff output in a text file foo@fee.com: paul fee@fee.com: paul fyii@fee.com: paul Could this be done on a bash script? I'm trying this... (1 Reply)
Discussion started by: packets
1 Replies

5. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies

6. Shell Programming and Scripting

How to grep the desired output and output to a file?

currently I have process from a raw file to this stage ALTER TABLE "EXCEL_ADMIN"."TC_TXN_VOID" ADD CONSTRAINT "PK_TC_TXN_VOID" PRIMARY KEY ("TC_TXN_IID") ALTER TABLE "EXCEL_ADMIN"."TC_TXN_AMT" ADD CONSTRAINT "PK_TC_TXN_AMT" PRIMARY KEY ("TC_TXN_AMT_IID") ALTER TABLE... (10 Replies)
Discussion started by: jediwannabe
10 Replies

7. Shell Programming and Scripting

Create a two column output in bash

Hi! I m newbie for scripting. My requirement is to create a host file as below from the output of aws api. Hostname PrivateIP abc x.y.x.z cde a.b.c.c and so on. I have the following script, #!/bin/bash export AWS_ACCESS_KEY=abc export... (5 Replies)
Discussion started by: cuteboyucsc
5 Replies

8. Shell Programming and Scripting

Need to develop a bash script to create customized report from the server log

Hi, I need to develop a bash script to create customized report from the server log (red hat 5.8 64 bit Operating system). The following is one of the log for our internal application task. <2015.03.03 20:09:52 274 +0800><I><DSCTH01><http-0.0.0.0-443-2><security> GUI request succeeded for... (1 Reply)
Discussion started by: pugazhendhi_r
1 Replies

9. Shell Programming and Scripting

awk to create variables to pass into a bash loop to create a download link

I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Discussion started by: cmccabe
8 Replies

10. Shell Programming and Scripting

Need to create a report using paste or with awk

Input file will be Name: serve1 has disk :Yes dev (8): Name: serve2 has disk :No dev (8): Name: serve3 has disk :No Name: serve4 has disk :Yes dev (8): Need output like that. I was using pate -d, - - - . But that need all the line in same format in this some server it has... (4 Replies)
Discussion started by: ranjancom2000
4 Replies
ZGREP(1)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 10:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy