Help in UNIX to Windows file formatting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help in UNIX to Windows file formatting
# 1  
Old 07-16-2014
Help in UNIX to Windows file formatting

Hi Techies,

i need in n UNIX to Windows file formatting.

i have created a csv file using a script and mailed it to my email, when i open the file with Excel sheet it looks like below


Code:
Collector_no|_|Collector_Name|_|SE_Count|_|Installed_Domains|_|CPU_Sys|_|CPU_Idle|_|Memory_Util
1|_|APOLLO16|_|   18412|_|ETN-CPE_Ciena_1,ETN-CPE_WWP_1,ETN_Alcatel_1,ETN_Huawei_1,ETN_Juniper_1,Epacity_Cisco_1,Epacity_Juniper_1,F5_Viprion_1,GIP_Huawei_1,GIT_Cisco_2,GMN_Cisco_1,KPN_FONIT_1,KPN_GIPIT_1,Proviso_Monitoring,WLAN-Gtw_Alcatel_1|_|0.32|_|92.41|_|20.1
10|_|APOLLO30|_|   17426|_|ETN_Alcatel_10|_|0.00|_|80.77|_|8.7

but i want the proper fields alignment when i open the file with Xls like below
Code:
S,NO	Collector No	Collector Name	No of Installed managed Objects (Sub Elements)	Installed Domains	CPU Utilization (Avg)		Memory Utilization - PVMD process
					Sys	Idle	
1	10	APOLLO30	17426	ETN_Alcatel_10	1.69	82	8.7
2	11	APOLLO31	None	None	0.03	99.92	1.1
3	12	APOLLO32	None	None	0.03	99.92	1.1
4	13	APOLLO33	49619	ETN-CPE_WWP_13	4.01	73.75	31.7

also see the attachment.

Kindly help me with this.
Help in UNIX to Windows file formatting-capturejpg

Last edited by Franklin52; 07-16-2014 at 04:18 PM.. Reason: Please use code tags
# 2  
Old 07-16-2014
You probably just need to add DOS-style end-of-line markers (CRLF rather than LF) - check if you have unix2dos on your system, or use tr/sed.

If that doesn't work, you need to post a sample of your csv file.
# 3  
Old 07-16-2014
Help in UNIX to Windows file formatting

herewith i attached the CSV file. please find the same and help meSmilie
# 4  
Old 07-16-2014
That certainly is not a .csv file. A .csv file is values separated by commas (or semicolons). Please show us that file and how you create it on the *nix side.
# 5  
Old 07-16-2014
It is a strange file because most programs will ignore the commas in between quotes.
Code:
unix2dos -n infile outfile

or
Code:
sed 's/$'"/`echo \\\r`/" infile > outfile

will convert the end of line characters from UNIX type to DOS however.

Mike

Last edited by Michael Stora; 07-16-2014 at 05:07 PM..
# 6  
Old 07-16-2014
Just curious, it seems that your original Unix based file is not a CSV file at all and actually has
Code:
|_|

as the delimiter? If so, that changes things a bit with the approach needed.
# 7  
Old 07-21-2014
Help in UNIX to Windows file formatting

Hi All,

here i'm pasting t he content of CSV file


Code:
Collector_no;Collector_Name;SE_Count;Installed_Domains;CPU_Sys;CPU_Idle;Memory_Util
10;APOLLO30;Proviso_Monitoring;   23273;1.50;83.94;13.9
11;APOLLO31;ETN-CPE_Alcatel-Lucent_11,Proviso_Monitoring;   39294;0.07;99.64;7.5
12;APOLLO32;ETN-CPE_Ciena_12,ETN-CPE_WWP_12,Proviso_Monitoring;   32863;0.05;99.77;7.2
13;APOLLO33;ETN-CPE_WWP_12,ETN-CPE_WWP_13,Proviso_Monitoring;   49619;3.82;69.88;32.5
14;APOLLO34;ETN-CPE_WWP_14,Proviso_Monitoring;   50290;3.54;84.06;38.3
15;APOLLO35;Proviso_Monitoring;       1;0.03;99.92;1.2
16;APOLLO36;ETN_Alcatel_16,Proviso_Monitoring;   24894;1.16;95.86;13.3
17;APOLLO37;GIP_Huawei_17,WLAN-GTW_Alcatel_17,Proviso_Monitoring;     320;0.04;99.82;1.7
18;APOLLO38;10GMIPBB_18,AOIP,GIT_18,GIT_Cisco_18,Proviso_Monitoring;   32092;0.08;98.96;10.9
19;APOLLO39;ETN_Juniper_19,Proviso_Monitoring;   15045;0.20;96.02;8.4
1;APOLLO21;ETN_Alcatel_test,ETN_Huawei_1,GIP_IT_1,Proviso_Monitoring;   27480;0.52;79.02;34.3
20;APOLLO40;EMTN-GSM_Alcatel_20,EMTN-LTE_Alcatel_20,EMTN-UMTS_Alcatel_20,F5_Viprion_20,IP_Service_Backbone_20,Proviso_Monitoring;    2397;0.07;99.46;3.1



I want the output like below in XLS file when i open the same in Windows env


Code:
S,NO	Collector No	Collector Name	No of Installed managed Objects (Sub Elements)	Installed Domains	CPU Utilization (Avg)		Memory Utilization - PVMD process
					Sys	Idle	
1	10	APOLLO30	17426	ETN_Alcatel_10	1.69	82	8.7
2	11	APOLLO31	None	None	0.03	99.92	1.1
3	12	APOLLO32	None	None	0.03	99.92	1.1
4	13	APOLLO33	49619	ETN-CPE_WWP_13	4.01	73.75	31.7


Last edited by Don Cragun; 07-21-2014 at 04:01 PM.. Reason: Add CODE tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Can Unix access Windows' File through Command Prompt in Unix

Hi all, I wish to know whether Unix can access window's file in Unix's terminal? Apart from that, how to copy files or share files between Window and Unix? I get to know of secure copy, however, my company's Unix does not support the feature of secure copy? Any other method for me to share/... (5 Replies)
Discussion started by: jessy83
5 Replies

2. Shell Programming and Scripting

Need help with formatting file in UNIX

hi, please help me with the below 1)i have a file like below with data 389096 389097 389098 ..and i need some thing like below '389096','ZZ1111' '389097','ZZ1111' '389098','ZZ1111' 2)i have a file like below with data 8300003225 8300003223 8300006494 (7 Replies)
Discussion started by: kr123
7 Replies

3. Shell Programming and Scripting

UNIX script to FTP file from UNIX server to windows

Hi, I am new to this subject.....Can someone please help me out with the script... unix usernm "sdhftst" unix pwd "chsd13" windows usernm "dfghtst" windows pwd "chsd13" path..../xxx/xxxxx/xxxxxx/xxxxxxx please can u get me a script...its only one file to get ftp. Thanks... (2 Replies)
Discussion started by: himakiran9
2 Replies

4. Shell Programming and Scripting

Formatting csv file in Unix script

Hi, Am using the following command to create a csv file paste File_1.csv File_4.csv File_7.csv >Out1.csv paste File_2.csv File_5.csv File_8.csv >>Out1.csv paste File_3.csv File_4.csv File_9.csv >>Out1.csv Input Data: Expected Output: Column 1 Column 2 ... (2 Replies)
Discussion started by: meva
2 Replies

5. Shell Programming and Scripting

Batch job in unix server to move the pdf file from unix to windows.

Hi Experts, I have a requirement where i need to setup a batch job which runs everymonth and move the pdf files from unix server to windows servers. Could some body provide the inputs for this. and also please provide the inputs on how to map the network dirve in the unix like that... (1 Reply)
Discussion started by: ger199901
1 Replies

6. Shell Programming and Scripting

File formatting in unix

Hi , I have a text file noname.txt containing 1000+ records like this. One of the record I have given below. Input will b e like this BOT: 2010/06/01 00:25:59 21 = "private" Access-Method = 31 NCC = GBR 01 =... (5 Replies)
Discussion started by: smalya
5 Replies

7. UNIX for Dummies Questions & Answers

Copy a windows CVS file to the unix server as a svs file

I so desperately need a script to copy a windows csv file to my unix server and i know these should be at dummies but i have no bits. it is life & no job situation help please. thanks (1 Reply)
Discussion started by: zhegal
1 Replies

8. Shell Programming and Scripting

Formatting text file in unix

Hi, I am using the following format command for formatting my text file in unix. awk -F":" '{ printf "%-50s%-1s%-50s\n", $1,":", $2}' filename > targetfile The target file is then sent as an attachment via email. When I view the target file in notepad multiple lines get spanned as a... (2 Replies)
Discussion started by: AAA
2 Replies

9. UNIX for Dummies Questions & Answers

formatting of file in unix

i have a txt file in which it contains some lines each line contains some 350-400 characters but when i read the file line by line in ksh it is telling the max characters in each line is between 100-127 characters in each line it contains some values with some spaces in between when i try to... (2 Replies)
Discussion started by: trichyselva
2 Replies

10. UNIX for Advanced & Expert Users

Formatting hard drive from Unix to Windows

Can a hard drive be formatted from unix server to windows 2000 professional? (4 Replies)
Discussion started by: howarddtp
4 Replies
Login or Register to Ask a Question