Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Messaging data into required report Post 302595304 by birei on Thursday 2nd of February 2012 04:41:03 PM
Old 02-02-2012
Hi gvolpini,

Correct me if I'm wrong, but as I understand the problem is with the format of the output data.

This could be a solution, adapt it to your source. I assume that infile has the CSV content of your script, and next program prints it as you wish.
Code:
$ cat infile
51176,qsc,/ureports/fusqsc/stmt,/home/dslmain/qsc/scripts/copylsoftosftpwithmove.sh,qscsftp@sftp1: prod/qsc/dsi/xml,EXPORT,<where>7862<any>DSI<any>.xml,YES
120004,bns,dslmain@faunus:import/svc,/home/dslmain/bns/scripts/copylsoffromsftpnomove.sh,/ureports/exportbns/svc,IMPORTNOMOVE,<where>fndmut<any>.svc,NO
120006,gjv,/ureports/exportbns/extracts/sent,/home/dslmain/bns/scripts/copylsoftosftp.sh,bnssftp@sftp1: prod/bns/export/extracts,NO,<where><any><yesterday>,NO
120007,bns,dslmain@faunus:import/svc,/home/dslmain/bns/scripts/copylsoffromsftpnomove.sh,/ureports/exportbns/svc,IMPORTNOMOVE,<where>fndmut<any>.svc,NO
120008,fid,/ureports/ibfid/jot/rpts/nofiche,/home/dslmain/fid/scripts/copylsoftosftp.sh,fidsftp@sftp1: prod/fid/jot/rpts/nofiche,YES,<where><any><yesterday><any>,NO
$ cat script.pl
use warnings;
use strict;

my (%client_data, $num_clients);

while ( my $line = <> ) {
        my ($rule, $client) = split /,/, $line;
        ++$num_clients;
        push @{ $client_data{ uc $client } }, $rule;
}


printf qq[Rules changed for %d clients: %s\n], 
                $num_clients, 
                join qq[, ], 
                        map { 
                                @{ $client_data{ $_ } } > 1 ? 
                                        $_ . qq[ x] . scalar @{ $client_data{ $_ } } 
                                                : 
                                        $_ } 
                                keys %client_data;

printf qq[The total number of Rules changed are: %d\n], $num_clients;

for ( keys %client_data ) {
        printf qq[Rules changed for %s: %s\n], 
                $_, 
                join qq[, ], @{ $client_data{ $_ } };
}

$ perl script.pl infile
Rules changed for 5 clients: QSC, FID, GJV, BNS x2
The total number of Rules changed are: 5
Rules changed for QSC: 51176
Rules changed for FID: 120008
Rules changed for GJV: 120006
Rules changed for BNS: 120004, 120007

Regards,
Birei
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help required with a Csh script to read data from a file

Dears, This is what i want.. I need to read a comma separated text file whose name is config.txt. whose content is like ; bscnara,btserrr bscsana,btssanacity ..... i need to read the first string and second string and use it to execute a another shell script. This is the logic. ... (1 Reply)
Discussion started by: fizzme
1 Replies

2. Shell Programming and Scripting

grep required data from two columns

hello, I have output from a command and I need to filter some info out of that. I tried awk command but I can not grep what I am looking for: Following is the output and I need to capture "disabled" for each volume from first column and report: # vol status Volume State ... (2 Replies)
Discussion started by: za_7565
2 Replies

3. UNIX for Advanced & Expert Users

sort out the required data

Hi All, I have a file 1.txt which has the duplicate dns entries as shown: Name: 000f9fbc6738.net.in|Addresses: 10.241.66.169, 10.84.2.222,212.241.66.170 Name: 001371e8ed3e.net.in|Addresses: 10.241.65.153, 10.84.1.101 Name: 00e06f5bd42a.net.in|Addresses: 10.72.19.218,... (6 Replies)
Discussion started by: imas
6 Replies

4. UNIX and Linux Applications

Get the data in my required form using gawk

i had the data in the following form: Branch : 3379 As On : 31-JAN-2009 Page : 1 User Id : OPER1 Date & Time : 01-FEB-2009 04:02:37 ... (2 Replies)
Discussion started by: KANNI786
2 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Packages required - Libaio.so.1 - Libstdc++so.6

hi guys I have to install a software that says have theses packages are required Libaio.so.1 Libstdc++so.6 are these default packages for a Suse 11 installation for instance? or do I need to download them to avoid dependency issues thanks a lot ---------- Post updated at 10:00 PM... (0 Replies)
Discussion started by: kopper
0 Replies

6. Shell Programming and Scripting

Perl script required for processing the data

I have following result.log file (always has 2 lines) which I need to process, cat result.log name.cmd.method,"result","abc","xyz"; name="hello,mine.12345,"&"tree"&" xyz "&" tree "&" xyz", data="way,"&" 1"&"rate-me"&"1"&"rate-me",str="",ret=""; now I need to extract the strings/data as... (4 Replies)
Discussion started by: perlDiva
4 Replies

7. Shell Programming and Scripting

List no. of files in a directory/sub dir's and also an consolidated report as required

Need help on below query asap. Thanks. The below is the directory structure: /home/suren under /suren the following are the directories /bin /log /error /bin contains the following files abc.txt bcd.ksh cde.sh wer.ksh ghi (file with out any extension) /log contains the following... (1 Reply)
Discussion started by: sureng
1 Replies

8. Shell Programming and Scripting

Need to cut a some required data from file

Data_Consolidation_Engine_Part_2_Job2..TgtArBkt: ORA-00942: table or view does not exist I have some thing like above in the file.. Upto this portion Data_Consolidation_Engine_Part_2_Job2..TgtArBkt: the length can be vary .. Can some one help me in taking this portion alone ORA-00942:... (7 Replies)
Discussion started by: saj
7 Replies

9. Shell Programming and Scripting

Help Need to fetch the required data

Hi Guys, Am in need of your help one more time on my real data. I have a file which contains more than thousand lines of data Live data shown for 4 iterations. We have more than thousand lines of data:- -------------------------------------------------------------------------- ... (4 Replies)
Discussion started by: rocky2013
4 Replies

10. Shell Programming and Scripting

Fetching the required data out of a tabular form

Hello Gurus, I am trying to fetch a required number of lines from an output of a command which is in tabular form. Below is the command for reference along with how the result is being shown on UNIX shell. /usr/openv/volmgr/bin/vmquery -b -p 5 The result of the above command is as... (6 Replies)
Discussion started by: Ali Sarwar
6 Replies
OSACOMPILE(1)						    BSD General Commands Manual 					     OSACOMPILE(1)

NAME
osacompile -- compile AppleScripts and other OSA language scripts SYNOPSIS
osacompile [-l language] [-e command] [-o name] [-d] [-r type:id] [-t type] [-c creator] [-x] [-s] [-u] [-a arch] [file ...] DESCRIPTION
osacompile compiles the given files, or standard input if none are listed, into a single output script. Files may be plain text or other compiled scripts. The options are as follows: -l language Override the language for any plain text files. Normally, plain text files are compiled as AppleScript. -e command Enter one line of a script. Script commands given via -e are prepended to the normal source, if any. Multiple -e options may be given to build up a multi-line script. Because most scripts use characters that are special to many shell programs (e.g., AppleScript uses single and double quote marks, ``('', ``)'', and ``*''), the command will have to be correctly quoted and escaped to get it past the shell intact. -o name Place the output in the file name. If -o is not specified, the resulting script is placed in the file ``a.scpt''. The value of -o partly determines the output file format; see below. -x Save the resulting script as execute-only. The following options are only relevant when creating a new bundled applet or droplet: -s Stay-open applet. -u Use startup screen. -a arch Create the applet or droplet for the specified target architecture arch. The allowable values are ``ppc'', ``i386'', and ``x86_64''. The default is to create a universal binary. The following options control the packaging of the output file. You should only need them for compatibility with classic Mac OS or for cus- tom file formats. -d Place the resulting script in the data fork of the output file. This is the default. -r type:id Place the resulting script in the resource fork of the output file, in the specified resource. -t type Set the output file type to type, where type is a four-character code. If this option is not specified, the creator code will not be set. -c creator Set the output file creator to creator, where creator is a four-character code. If this option is not specified, the creator code will not be set. If no options are specified, osacompile produces a Mac OS X format script file: data fork only, with no type or creator code. If the -o option is specified and the file does not already exist, osacompile uses the filename extension to determine what type of file to create. If the filename ends with ``.app'', it creates a bundled applet or droplet. If the filename ends with ``.scptd'', it creates a bun- dled compiled script. Otherwise, it creates a flat file with the script data placed according to the values of the -d and -r options. EXAMPLES
To produce a script compatible with classic Mac OS: osacompile -r scpt:128 -t osas -c ToyS example.applescript SEE ALSO
osascript(1), osalang(1) Mac OS X November 12, 2008 Mac OS X
All times are GMT -4. The time now is 11:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy