Sponsored Content
Top Forums Shell Programming and Scripting Formatting data to put it in the excel file Post 302955730 by rahul2662 on Monday 21st of September 2015 07:08:13 AM
Old 09-21-2015
I first removed all the blank lines using : sed -i '/^$/d'

Then I tried to use this :

Code:
awk 'BEGIN { RS="------------------------------------------------------------";FS="\n";ORS="\n";OFS="," } { print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11}' file.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

I futher did this :

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

I am not getting proper format.

Thanks
Rahul

Last edited by rahul2662; 09-21-2015 at 08:17 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
Perl::Critic::Policy::ValuesAndExpressions::RequireQuoteUsereContriPerl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator(3pm)

NAME
Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator - Write " print <<'THE_END' " or " print <<"THE_END" ". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Putting single or double-quotes around your HEREDOC terminator make it obvious to the reader whether the content is going to be interpolated or not. print <<END_MESSAGE; #not ok Hello World END_MESSAGE print <<'END_MESSAGE'; #ok Hello World END_MESSAGE print <<"END_MESSAGE"; #ok $greeting END_MESSAGE CONFIGURATION
This Policy is not configurable except for the standard options. SEE ALSO
Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.14.2 Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator(3pm)
All times are GMT -4. The time now is 12:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy