[SOLVED] Quick way to convert spaces in text file to tabs to copy to spreadsheet?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Quick way to convert spaces in text file to tabs to copy to spreadsheet?
Hi.
I have a file with dates and then weights (kg). They are separated by a space.
i.e.: 2019-08-01 68.7
I'd like to copy this long list to a spreadsheet once in a while to show a graph of my weight and other peoples weights. Is there a quick method to do this?
The answer is: yes. You can also implement it easily in bash.
But from your side: Which language/tool do you prefer? What did you try so far? Where did you stuck?
Depends on spreadsheet app. Excel and libreoffice as far as I know have the capability to select the delimiter i.e as a space, tab or comma etc or fixed width so conversion is probably not necessary.
Depends on spreadsheet app. Excel and libreoffice as far as I know have the capability to select the delimiter i.e as a space, tab or comma etc or fixed width so conversion is probably not necessary.
Quote:
Originally Posted by syg00
So if the OP had made some effort .... :shrug:
Agree and concur.
Not so proficient with the Linux varieties of spreadsheets, but I know that one can import data and many times there's a preview of that data which shows, and allows you to change you delimiter so that you can get it right, while viewing the previews.
So just try this, and I would prefer to stay away from a bunch of text processing tools. I do not feel they are necessary.
Or, to be kinder about it. Have you already tried this, and found it to be flawed in some manner?
Calc will import the file fine checking 'space' as a delimiter.
Off Topic: I understand the rationale for asking someone who just joined what they have tried but IMO grilling a Contributing Member who has 3500+ posts is unnecessary. Just my 2 cents.
The answer is: yes. You can also implement it easily in bash.
But from your side: Which language/tool do you prefer? What did you try so far? Where did you stuck?
Hi pan64. I'm not too fussed on the language. It's solved now anyway. Thanks.
Calc will import the file fine checking 'space' as a delimiter.
Off Topic: I understand the rationale for asking someone who just joined what they have tried but IMO grilling a Contributing Member who has 3500+ posts is unnecessary. Just my 2 cents.
Hi mjolnir. Yes, that's ideal. Thank you.
Last edited by linustalman; 08-17-2019 at 09:26 AM.
Reason: added 'Thank you.'
hm. I have never heard about expand/unexpand, both can be implemented easily in awk/perl/python/whatever, still interesting that we have a ready-made tool for this.
something to learn again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.