Sponsored Content
Full Discussion: Convert each field to excel
Top Forums Shell Programming and Scripting Convert each field to excel Post 302160415 by Ygor on Monday 21st of January 2008 08:10:55 PM
Old 01-21-2008
Try using using awk to convert to html, then load into excel....
Code:
awk 'BEGIN{
  FS="|"
  cols=4
  print "<HTML><BODY><TABLE>"
}
NF==cols{
  if(NR>1)
    print "</TD></TR>"
  printf "<TR>"
  for(i=1;i<NF;i++)
    printf "<TD>%s</TD>", $i
  printf "<TD>%s", $NF
}
NF==1{
  printf "\n%s", $0
}
END{
  print "</TD></TR>\n</TABLE></BODY></HTML>"
}
' file1 > file2.xls

Tested on file:
Code:
a1|a2|a3|a4
b1|b2|b3|b
4
c1|c2|c3|c4

Output:
Code:
<HTML><BODY><TABLE>
<TR><TD>a1</TD><TD>a2</TD><TD>a3</TD><TD>a4</TD><TR>
<TR><TD>b1</TD><TD>b2</TD><TD>b3</TD><TD>b
4</TD><TR>
<TR><TD>c1</TD><TD>c2</TD><TD>c3</TD><TD>c4</TD><TR>
</TABLE></BODY></HTML>

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

convert Text to Excel

I have some text data generated by a perl script and want to put it into an excel sheet. Is there a perl script that can do this for me, i.e, convert text data to excel? (1 Reply)
Discussion started by: Pavankk
1 Replies

2. Shell Programming and Scripting

Convert to excel

Hi to all the tycoons of Shell programming!! I am getting a csv report out of a query and the report is delimited with '|' symbol. I would like to convert this csv report into an xls column wise.. Let me show u an example as below Say a.csv looks like below Number|Description|Cycle|Date... (6 Replies)
Discussion started by: ganga.dharan
6 Replies

3. Shell Programming and Scripting

how to convert fields from a text file to excel columns

i have this file which has the following contents: ,-0.3000 ,-0.3000 ,-0.3000 ,-0.9000 ,-0.9000 ,-0.9000 i would like to get this: -0.3-0.9-0.3-0.9-0.3-0.9 so far i am trying: awk '{for(i=1; i<=NF; i++) {printf("%f\n",$i)}}' test1 > test2 any help... (4 Replies)
Discussion started by: npatwardhan
4 Replies

4. UNIX for Advanced & Expert Users

how to convert text/csv to excel

Hello All, I have a sql report with 50 columns and 1000 rows result in a file ( txt / csv). is there is any way that we can move them to excel in KSH. Thanks, Sateesh (7 Replies)
Discussion started by: kotasateesh
7 Replies

5. Shell Programming and Scripting

Convert array data to excel format

I need your help in changing the script I have data has below text file :> cat my_emp Employee array(0) Name : Albert No : 1234 Address: stationstraat City: Utrecht Employee array (1) Name : Kouwen No : 1256 Address: stationstraat City: Amsterdam Employee array (2) Name : Peter... (2 Replies)
Discussion started by: LinuxLearner
2 Replies

6. Shell Programming and Scripting

How to convert Excel Files to Xls?

Hi All, I have created a BI Publisher report in Oracle apps R12. It has generated the output with *.EXCEL file extension. I have a shell script to mail this output. in my shell script I have copied this file and saved as *.xls file. But the R12 generated *.EXCEL file is not a real excel... (5 Replies)
Discussion started by: kalidoss
5 Replies

7. UNIX for Dummies Questions & Answers

Convert csv to excel

Hi All, I have a csv file in unix and I need to convert it into excel formate. Please help me out (1 Reply)
Discussion started by: Abhisrajput
1 Replies

8. Shell Programming and Scripting

Need to convert text file into Excel sheet

:cool:Hi, Iam new to this Scripts and forum too. Plz excuse if may i ask silly questions now and further.. Prob: i need to convert txt files data into excel sheet. Suppose if i have hour-wise data in txt file1 and file2 like file1 file2 00: 140 00: 235 01: 160 01:415... (1 Reply)
Discussion started by: mrudula
1 Replies

9. Shell Programming and Scripting

Convert excel to csv in python date not display exactly

Hi, Anyone can help I am just converting the excel file to csv using python, I can get the conversion output but the date not display exactly. test.xlsx date format 167 1588 risks/SCS JP CAMPANA & CIE.pdf SCS JP CAMPANA & CIE 2 1 1 0 2015-03-16 16:56:25 167 1146 risks/AirBNB... (1 Reply)
Discussion started by: fspalero
1 Replies

10. Shell Programming and Scripting

Convert excel to tab

Hello, I have an excel sheet (.xlsx), with 11 worksheets. I need to run my bash scripts on the 1st worksheet and write the output to the 2nd worksheet. I am currently manually converting the worksheet into a tab delimited to run the script and then pasting it back to excel. Is there a way to do... (2 Replies)
Discussion started by: nans
2 Replies
xscreensaver-text(1)						XScreenSaver manual					      xscreensaver-text(1)

NAME
xscreensaver-text - prints some text to stdout, for use by screen savers. SYNOPSIS
xscreensaver-text [--verbose] [--columns N] [--text STRING] [--file PATH] [--program CMD] [--url URL] DESCRIPTION
The xscreensaver-text script prints out some text for use by various screensavers, according to the options set in the ~/.xscreensaver file. This may dump the contents of a file, run a program, or load a URL. OPTIONS
xscreensaver-text accepts the following options: --columns N or --cols N Where to wrap lines; default 72 columns. --verbose or -v Print diagnostics to stderr. Multiple -v switches increase the amount of output. Command line options may be used to override the settings in the ~/.xscreensaver file: --string STRING Print the given string. It may contain % escape sequences as per strftime(2). --file PATH Print the contents of the given file. If --cols is specified, re-wrap the lines; otherwise, print them as-is. --program CMD Run the given program and print its output. If --cols is specified, re-wrap the output. --url HTTP-URL Download and print the contents of the HTTP document. If it contains HTML, RSS, or Atom, it will be converted to plain-text. Note: this re-downloads the document every time it is run! It might be considered abusive for you to point this at a web server that you do not control! ENVIRONMENT
HTTP_PROXY or http_proxy to get the default HTTP proxy host and port. BUGS
The RSS and Atom output is always ISO-8859-1, regardless of locale. URLs should be cached, use "If-Modified-Since", and obey "Expires". SEE ALSO
xscreensaver-demo(1), xscreensaver(1), fortune(1), phosphor(1), apple2(1), starwars(1), fontglide(1), dadadodo(1), webcollage(1), http://www.livejournal.com/stats/latest-rss.bml, http://twitter.com/statuses/public_timeline.atom, driftnet(1), EtherPEG, EtherPeek COPYRIGHT
Copyright (C) 2005 by Jamie Zawinski. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. AUTHOR
Jamie Zawinski <jwz@jwz.org>, 20-Mar-2005. X Version 11 5.15 (28-Sep-2011) xscreensaver-text(1)
All times are GMT -4. The time now is 08:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy