Need help getting data into legible format...maybe awk?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help getting data into legible format...maybe awk?
# 1  
Old 05-09-2012
Need help getting data into legible format...maybe awk?

Good morning,

I am still learning the powers of awk and perl. I am in need of a bit of help.

I have a script on one of my launch systems...if that is even the word for it. Basically you can only ssh to a system if you are connected to this system due to firewalls.

So from that system, I have an SSHTool script that I can execute commands on remote machines or copy files out to them so I don't have to ssh to 150+ systems one at a time.

When I type in the command, it returns to standard out on my system.

I typed the 'script' command first so that it would send all output to a typescript file for me to sort through.

What I am trying to do is create a list of all scripts that are in cron on those systems for a particular user. I am not sure what I want the output to look like. I was thinking either this:

Code:
script
-----
name of server
name of server
name of server

So the above would list each script in one column and then all servers that are running that in cron underneath.

Or I was thinking:

Code:
server
-----
name of script
name of script
name of script

So the above would list all servers and then under that the scripts running on it.

I would also like some sort of output that lists the servers that are different...meaning that they either have less or more scripts than the others. For example, let's say that every server has 5 standard scripts in cron; but there is one server that only has 3 or maybe it has 6.

Please let me know if this is possible.

Here is a sample of my typescript file:

Code:
username@10.10.10.10's password:   1   0   *   * 1-5   /randomdir/cron/zonefile_checks.sh
   1   0   *   *   *   /randomdir/DNS_Stats.sh -m
 */5   *   *   *   *   /randomdir/cron/File_Handle_Monitor.sh
 */5   *   *   *   *   /randomdir/cron/Random_Status_Monitor.sh
   0   5   *   *   *   /randomdir/cron/AMQ_reset.sh -s 1800
*/10   *   *   *   *   /randomdir/cron/named_stats.sh
Connecting to: 10.10.10.54...
spawn /bin/ssh username@10.10.10.54 crontab -l ^M
^M
******************************************************************^M
******************************************************************^M
**               N O T I C E  T O  U S E R S                    **^M
******************************************************************^M
******************************************************************^M
** security banner **
** security banner **
** security banner **
** security banner **
** security banner **
** security banner **
** security banner **
******************************************************************^M
******************************************************************^M
**               N O T I C E  T O  U S E R S                    **^M
******************************************************************^M
******************************************************************^M
^M
username@10.10.10.54's password:   1   0   *   * 1-5   /randomdir/cron/zonefile_checks.sh
   1   0   *   *   *   /randomdir/DNS_Stats.sh -m
 */5   *   *   *   *   /randomdir/cron/File_Handle_Monitor.sh
 */5   *   *   *   *   /randomdir/cron/Random_Status_Monitor.sh
   0   5   *   *   *   /randomdir/cron/AMQ_reset.sh -s 1800
*/10   *   *   *   *   /randomdir/cron/named_stats.sh
Connecting to: 10.10.10.37...

Notice that in the above it connects to the server and executes the command. The first line of 'crontab -l' is on the same line as "username@balh's password".

Thank you in advance.
# 2  
Old 05-09-2012
First I would try to modify your "crontab -l" command so that information is easy to extract from this bit messy file, adding hostname for later convenience in parsing. Try running this instead of plain "crontab -l":
Code:
crontab -l | cat <(echo "CRONTAB HEAD"; echo "SERVER: "`hostname`) - <(echo "CRONTAB TAIL")

This User Gave Thanks to bartus11 For This Post:
# 3  
Old 05-09-2012
Thanks bartus. let me run it like that and see.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Format Data - awk ..

/clusters/cluster-1/exports/storage-views/M1_CRE03_SV: Name Value ------------------------ --------------------------------------------------------------------------------------------------- caw-enabled true controller-tag - initiators ... (7 Replies)
Discussion started by: greycells
7 Replies

2. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

3. Shell Programming and Scripting

Converting text files to xls through awk script for specific data format

Dear Friends, I am in urgent need for awk/sed/sh script for converting a specific data format (.txt) to .xls. The input is as follows: >gi|1234|ref| Query = 1 - 65, Target = 1677 - 1733 Score = 8.38, E = 0.6529, P = 0.0001513, GC = 46 fd sdfsdfsdfsdf fsdfdsfdfdfdfdfdf... (6 Replies)
Discussion started by: Amit1
6 Replies

4. UNIX for Dummies Questions & Answers

Des/awk for change format and adding integers in a column of data?

Greetings! I need a quick way to change the format in a table of data Here is an example of the input: 10 72 Value=177 VDB=0.0245 Value4=0,0,171,0 10 274 Value=238 VDB=0.0433 Value4=29,0,205,0 10 312 Value=222 VDB=0.0384 Value4=8,0,190,19 10 540 Value=405 VDB=0.0391 Value4=13,30,153,195... (3 Replies)
Discussion started by: Twinklefingers
3 Replies

5. Shell Programming and Scripting

awk - script help: column to row format of data allignment?

Experts Good day, I have the following data, file1 BRAAGRP1 A2X B2X C2X D2X BRBGRP12 A3X B3X Z10 D09 BRC1GRP2 LO01 (4 Replies)
Discussion started by: rveri
4 Replies

6. Shell Programming and Scripting

Arrange / format data using awk

Input 217:fngadi4osa:fngadi4osa:M 217:415744:N/A 227:fngadi4osa:fngadi4osa: M 227:51200:N/A 228:fngadi4osa:fngadi4osa: M 228:102400:N/A 65:sapgt04:sapgt04: M 65:104448:N/A 228:fngadi4osa:fngadi4oma: M 228:102400:N/A Output 217:fngadi4osa:fngadi4osa:M 217:415744:N/A... (3 Replies)
Discussion started by: greycells
3 Replies

7. Shell Programming and Scripting

Using Awk for extracting data in specific format

please help me writing a awk script 001_r.pdb 0.0265185 001_r.pdb 0.0437049 001_r.pdb 0.0240642 001_r.pdb 0.0310264 001_r.pdb 0.0200482 001_r.pdb 0.0146746 001_r.pdb 0.0351344 001_r.pdb 0.0347856 001_r.pdb 0.036119 001_r.pdb 1.49 002_r.pdb 0.0281011 002_r.pdb 0.0319908 002_r.pdb... (5 Replies)
Discussion started by: phoenix_nebula
5 Replies

8. Shell Programming and Scripting

Format - Inventory Row data into Column - Awk - Nawk

Hi All, I have the following file that has computer data for various pcs in my network... Snap of the file is as follows ******************************************************************************* Serial 123456 Computer IP Address lo0:... (1 Reply)
Discussion started by: aavam
1 Replies

9. UNIX for Dummies Questions & Answers

converting a tabular format data to comma seperated data in KSH

Hi, Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent. E.g : username empid ------------------------ sri 123 to username,empid sri,123 Thanks, Hema:confused: (2 Replies)
Discussion started by: Hemamalini
2 Replies

10. Shell Programming and Scripting

data format from (4.56 0.7) -> 4.6(7) awk?!

Hi, I have to manipulate a data file which say reads like this {$index $value $error_on_value} aa 4.56 0.7 bb 123.456 0.00987 cc 987654 321 . . in easily human readable format of type aa 4.6(7) bb 123.456(1) cc 9.877(3)e+05 value rounded to 4.6 with error of 0.7 on the last... (4 Replies)
Discussion started by: ahan
4 Replies
Login or Register to Ask a Question