Sponsored Content
Top Forums Shell Programming and Scripting Formatting data to put it in the excel file Post 302955724 by rahul2662 on Monday 21st of September 2015 06:40:09 AM
Old 09-21-2015
Formatting data to put it in the excel file

Hello,

I have a file with the below contents :

Code:
Policy Name:       Backup_bkp

  Policy Type:         Catalog_bkp
  Active:              yes
  Effective date:      08/07/2013 02:02:12
  Mult. Data Streams:  no
  Client Encrypt:      no
  Checkpoint:          no
  Policy Priority:     0
  Max Jobs/Policy:     1
  Disaster Recovery:   0
  Collect BMR info:    no
  Residence:           xyz
  Volume Pool:         Backup
  Server Group:        *ANY*
  Keyword:             (none specified)
  Data Classification:       -
  Residence is Storage Lifecycle Policy:    no
  Application Discovery:      no
  Discovery Lifetime:      0 seconds
ASC Application and attributes: (none defined)

------------------------------------------------------------

Policy Name:       002

  Policy Type:         MS-Windows
  Active:              yes
  Effective date:      07/15/2013 22:26:40
  Backup network drvs: no
  Collect TIR info:    no
  Mult. Data Streams:  no
  Client Encrypt:      no
  Checkpoint:          yes
       Interval:       15
  Policy Priority:     0
  Max Jobs/Policy:     Unlimited
  Disaster Recovery:   0
  Collect BMR info:    no
  Residence:           dfg
  Volume Pool:         NetBackup
  Server Group:        *ANY*
  Keyword:             (none specified)
  Data Classification:       -
  Residence is Storage Lifecycle Policy:    no
  Application Discovery:      no
  Discovery Lifetime:      0 seconds
ASC Application and attributes: (none defined)

Here the record separator (RS) is "------------------------------------------------------------" .I want to format the data and put it in the excel in the following way :

Code:
Policy Name      Policy Type    Active   Effective date                   ...other columns
Backup_bkp     Catalog_bkp   yes      08/07/2013 02:02:12      ...other columns
002                 MS-Windows   yes      07/15/2013 22:26:40     ...other columns


I further did the following :

Code:
 awk 'BEGIN { RS="------------------------------------------------------------";FS="\n";OFS=",";ORS="\n"} { print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11}' script4_tmp2.txt

Code:
Policy Name:       Backup_bkp,  Policy Type:         Catalog_bkp,  Active:              yes,  Effective date:      08/07/2013 02:02:12,  Mult. Data Streams:  no,  Client Encrypt:      no,  Checkpoint:          no,  Policy Priority:     0,  Max Jobs/Policy:     1,  Disaster Recovery:   0,  Collect BMR info:    no
,Policy Name:       002,  Policy Type:         MS-Windows,  Active:              yes,  Effective date:      07/15/2013 22:26:40,  Backup network drvs: no,  Collect TIR info:    no,  Mult. Data Streams:  no,  Client Encrypt:      no,  Checkpoint:          yes,       Interval:       15

Could someone please help me.

Thanks
Rahul

Last edited by rahul2662; 09-21-2015 at 08:14 AM..
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Formatting excel file

Hi, I have a problem in formatting the excel file from my script. Assume that there is a text file generated using a 'C shell Unix script' with a format similar to the one seen below. Each column has a fixed length and every row is going to have a value against a column depending on the... (1 Reply)
Discussion started by: subra
1 Replies

2. Shell Programming and Scripting

how to copy data to to excel file

Hi, Can any one tell me how to copy data using shell script to a excel file from text file to other columns of excel file,leaving first column unaffected i.e it should not overwrite data in first column. Say my text file data is: 15-dec-2008 15-dec-2009 16-dec-2008 16-dec-2009 ... (7 Replies)
Discussion started by: tucs_123
7 Replies

3. Shell Programming and Scripting

Copying data from excel file

Hii friends, I am a newbie to unix/shell scripting and got stuck in implementing a functionality.Dear experts,kindly spare some time to bring me out of dark pit :confused:.. My requirement is somewhat wierd,let me explain what i have and what i need to do... 1) there are several excel... (1 Reply)
Discussion started by: 5ahen
1 Replies

4. UNIX for Advanced & Expert Users

filter last 24 hour data and put in new file

i have file server 1 (filesvr01acess.log) and disc server 1 (discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.81) Similiarly i have file server 2 (filesvr01acess.log) and disc server 2(discsvr01acess.log) in another unix box(say ip adress of the box 10.39.66.82). Now my... (1 Reply)
Discussion started by: nripa1
1 Replies

5. Shell Programming and Scripting

how to put data using shell script to a excel file

Hi, Can any one tell me how to put data using shell script to a excel file from text file to other columns of excel file,leaving first column unaffected i.e it should not overwrite data in first column. Say my text file data is: 15-dec-2008 15-dec-2009 16-dec-2008 16-dec-2009 say my first... (1 Reply)
Discussion started by: siri_886
1 Replies

6. UNIX for Advanced & Expert Users

put data in excel file using shell script

Hi. I wish to add data in a specific excel file on daily basis.However the currect dat's data should always come on top i.e for example should always occupy cell A7,B7,C7 .. and the data of day before which was earlier on 7th row of each coloumn should move to 8th row..data on 8th row should... (1 Reply)
Discussion started by: kanus
1 Replies

7. Shell Programming and Scripting

Writing excel file using perl : Excel file formatting changed

I am trying to create a program where user can input data in certain excel cells using user interface on internet....the programming is on perl and server is unix But when i parse data into excel the formatting of sheets is turned to default and all macro coding removed. What to do...Please... (7 Replies)
Discussion started by: mud_born
7 Replies

8. Shell Programming and Scripting

Data formatting in CSV file to EXCEL

Hello friends I want to convert an csv file on unix (which is generated by a ETL application) to a formatted excel sheet like .I have roughly like 28 columns 1)All numbers need to be stored as numbers with leading zeros-like format as text for this column to preserve leading zeroes e.g... (6 Replies)
Discussion started by: etldev
6 Replies

9. 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

10. Shell Programming and Scripting

Visit site get data and put in file for use.

I need to go to "vpnbook"vpnbook.com on the web (can't put in name yet)and open "Openvpn" tab On that page I need to get the username:vpnbook and the next line password:???????? I need to put those two in line one and two of a file "pwfile" When I have those I need to open openVPN with the... (1 Reply)
Discussion started by: tytower
1 Replies
All times are GMT -4. The time now is 06:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy