- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- How to convert text to csv or xls?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 08:40 AM
тАО03-29-2006 08:40 AM
This has to be done at the Unix level - not from Windows...needs to be part of a script...
Thanks...Geoff
Solved! Go to Solution.
- Tags:
- csv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 08:43 AM
тАО03-29-2006 08:43 AM
Re: How to convert text to csv or xls?
# tr "\t" ","
cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 08:50 AM
тАО03-29-2006 08:50 AM
Re: How to convert text to csv or xls?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 08:50 AM
тАО03-29-2006 08:50 AM
Re: How to convert text to csv or xls?
Basically, I want to open in Excel (or management does) and not have to do a "data" -> "Text to columns" every time....
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 08:57 AM
тАО03-29-2006 08:57 AM
Re: How to convert text to csv or xls?
I would look hard at the Text::CSV Perl module.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 08:57 AM
тАО03-29-2006 08:57 AM
Re: How to convert text to csv or xls?
I took your data file and imported in excel.
Was this what you where trying to do?
open excel
file
open - pick your file
Deleminited is checked
Next
Tab
Finish.
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 08:59 AM
тАО03-29-2006 08:59 AM
Re: How to convert text to csv or xls?
Try this:
# perl -pe 's/(.+?)\t+/"$1",/g;s/,([^"]+?)$/,"$1"/' filename
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 09:02 AM
тАО03-29-2006 09:02 AM
Re: How to convert text to csv or xls?
I agree with Clay, I would look hard to Text::CSV Perl module and/or after I would use Spreadsheet::WriteExcel to create this file.
http://search.cpan.org/~alancitt/Text-CSV-0.01/CSV.pm
http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.16/lib/Spreadsheet/WriteExcel.pm
Hope this helps
Kenavo
Pat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 09:05 AM
тАО03-29-2006 09:05 AM
Re: How to convert text to csv or xls?
Sandmans tr works fine.
Clay - yes - I've heard of that module - through google - I may have to look at it further..
James - yours works as well....
Kent - yours dropped the last column for some reason?
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2006 09:15 AM
тАО03-29-2006 09:15 AM
Re: How to convert text to csv or xls?
That is going to take me a wee bit to disect....
Is there a Perl Doctor in the house? :)
Here's my script so far:
#!/bin/sh
#
# EC-Inventory-Data-Collection script
# uses data gathered by /opt/AssetCentre/asset_reporting.ksh
# which is stored in /var/opt/AssetCentre/reports
#
#
RPTDIR=/var/opt/AssetCentre/reports
TMPFIL=/tmp/EC-Inventory-Data.txt
CSV=/htdocs/mambo/dmdocuments/Infrastructure/Server-Planning/EC-Inventory-Data-Collection.csv
if [ -f $CSV ] ;
then
cp -p $CSV $CSV.old
fi
cat $RPTDIR/label > $TMPFIL
for SERVER in `ls $RPTDIR/*.value`
do
cat $SERVER >> $TMPFIL
done
tr "\t" "," <$TMPFIL >$CSV
The SERVER.value (tab delimited) files are created from another script - all I want to do is gather all that individual info and put it in a spreadsheet...
Thanks...Geoff