Displaying the output in the tabular Format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Displaying the output in the tabular Format
# 1  
Old 05-11-2010
Displaying the output in the tabular Format

Hi,

I have a file which contains the data in the below format and need to develop a script which will give the output in the tabular format.

Could you please advice me.

Code:
Folder: [Tutorial]
Workflow: [wf_ABC] version [1].
Workflow run status: [Scheduled]
Workflow run error code: [0]
Schedule time: [Wed May 12 00:05:00 2010]
Workflow run type: [Schedule]
Run workflow as user: [John]
Integration Service: [Inte_Ser]
Folder: [Test]
Workflow: [Wf_Xyz] version [1].
Workflow run status: [Scheduled]
Workflow run error code: [0]
Schedule time: [Wed May 12 00:05:00 2010]
Workflow run type: [Schedule]
Run workflow as user: [Administrator]
Integration Service: [Inte_Ser]
---
---
---

Output : -

Code:
Folder Name 	Workflow Name 	Scheduled Time
======================================================
Tutorial	              wf_ABC		12-May-2010 00:05:00
Test		 Wf_Xyz		12-May-2010 00:05:00


Last edited by pludi; 05-11-2010 at 10:21 AM.. Reason: code tags, please...
kandi.reddy
# 2  
Old 05-11-2010
Code:
$
$
$ cat f1
Folder: [Tutorial]
Workflow: [wf_ABC] version [1].
Workflow run status: [Scheduled]
Workflow run error code: [0]
Schedule time: [Wed May 12 00:05:00 2010]
Workflow run type: [Schedule]
Run workflow as user: [John]
Integration Service: [Inte_Ser]
Folder: [Test]
Workflow: [Wf_Xyz] version [1].
Workflow run status: [Scheduled]
Workflow run error code: [0]
Schedule time: [Wed May 12 00:05:00 2010]
Workflow run type: [Schedule]
Run workflow as user: [Administrator]
Integration Service: [Inte_Ser]
$
$
$ ##
$ perl -ne 'BEGIN {printf("%-20s %-20s %-s\n", "Folder Name", "Workflow Name", "Scheduled Time");
>                  printf("%s %s %s\n", "="x20, "="x20, "="x24)}
>           if (/^Folder: \[(.*?)\]/) {printf("%-20s ",$1)}
>           elsif (/^Workflow: \[(.*?)\]/) {printf("%-20s ",$1)}
>           elsif (/^Schedule time: \[(.*?)\]/) {printf("%-s\n",$1)}
>          ' f1
Folder Name          Workflow Name        Scheduled Time
==================== ==================== ========================
Tutorial             wf_ABC               Wed May 12 00:05:00 2010
Test                 Wf_Xyz               Wed May 12 00:05:00 2010
$
$

tyler_durden
# 3  
Old 05-11-2010
data.dat is the inputfile.
Code:
$ cat createtable.sh
#!/bin/sh

echo "Folder Name           Workflow Name         Scheduled Time"
echo "====================  ====================  ========================"

<data.dat grep -E 'Folder:|Workflow:|Schedule time:' | sed -n 'N;N;s/\n/ /gp' |\
sed 's/Folder: \[//;s/\] Workflow: \[/,/;s/\].*: \[/,/;s/]$//' |
while read line
do
a=$(echo $line | sed 's/,.*//')
b=$(echo $line | sed 's/.*,\(.*\),.*/\1/')
c=$(echo $line | sed 's/.*,//')
printf "%-21s %-21s %-25s\n"  "$a" "$b" "$c"
done

Code:
$ ./createtable.sh
Folder Name           Workflow Name         Scheduled Time
====================  ====================  ========================
Tutorial              wf_ABC                Wed May 12 00:05:00 2010 
Test                  Wf_Xyz                Wed May 12 00:05:00 2010 
$

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To have a mail in tabular format

Hello Guys, developing a monitoring shell script to have my queue depth count over mail . here is the sample input file to the script which has all the queue names 1 : DISPLAY QUEUE(*) WHERE (CURDEPTH GT 0) ZFC8409: Display Queue details. QUEUE(QL.GVR.ATA.CACHE.01) ... (10 Replies)
Discussion started by: wims
10 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

Mailing query results in tabular format

Hi , I am purging two tables based on date. In my script I am taking the count of the tables purging them and then taking the after counts. I need to mail the before and after counts of the two tables in a mail in table format as mentioned in the result section. For Eg: ## Count of the... (14 Replies)
Discussion started by: CFA
14 Replies

4. Shell Programming and Scripting

Grep command output in tabular format

I have a grep command script which works fine and give the correct results but i wanted the output to be displayed in tabular format ? Is it possible to display the output in tabular format and as well direct them to some file. main script : #!/usr/bin/bash Start_Time=`date '+%m%d%y... (1 Reply)
Discussion started by: Optimus81
1 Replies

5. Shell Programming and Scripting

Convert data to a tabular format

How can i convert the below data to a simpler format :- cat tabular.txt User 1 Details :- First Name = Tom Middle Name = Last Name = Hanks Age = 40 Address = User 2 details :- First Name = Mike Middle Name = Last Name = Tyson Age = 50 Address = (2 Replies)
Discussion started by: lazydev
2 Replies

6. UNIX for Dummies Questions & Answers

Help! needed to displaying an output in record format

Hi Friends, Am new to Unix world and this is my first post in this forum. I was stuck in displaying the content. while displaying the content the below points to be taken care 1 ) The header format is repeating 2) To display the value in table format... (2 Replies)
Discussion started by: rocky2013
2 Replies

7. Shell Programming and Scripting

Extract data in tabular format from multiple files

Hi, I have directory with multiple files from which i need to extract portion of specif lines and insert it in a new file, the new file will contain a separate columns for each file data. Example: I need to extract Value_1 & Value_3 from all files and insert in output file as below: ... (2 Replies)
Discussion started by: belalr
2 Replies

8. Shell Programming and Scripting

Displaying log file pattern output in tabular form output

Hi All, I have result log file which looks like this (below): from the content need to consolidate the result and put it in tabular form 1). Intercomponents Checking Passed: All Server are passed. ====================================================================== 2). OS version Checking... (9 Replies)
Discussion started by: Optimus81
9 Replies

9. UNIX for Advanced & Expert Users

How to export Result to Excel Tabular format from UNIX?

Hi I am working on a script in which I am firing a query on database through Unix and getting the result set. I want to export that in an excel file. I am able to do so nut the result are exported horizontally one below the other. Can anyone plss help me out in exporting the Result in Tabular... (4 Replies)
Discussion started by: Saritau3
4 Replies

10. Shell Programming and Scripting

Displaying output in the tabular format

Hi I want to display the following input data into the tabular format as shown in the output. Input.txt: Following jobs are in pending state for more than 10 minutes: JOB_ID JOB_SUBMIT_ID MAHAR 784308 PUNJA 109367 Following jobs are running for longer time: JOB_ID... (1 Reply)
Discussion started by: dats
1 Replies
Login or Register to Ask a Question