Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I've looked across the net and tried several scripts, but none of them give me the correct output.
I have a file with a header line with 50+ entries I'd like to take this row data and break it into multiple column data with and assign it an index number.
would be nice to specify it better, and also show us what have you tried. It looks easy for awk or perl, but I still do not know how should be the output organized.
That goes for the input too. What do the lines after the header look like? How many are there? How exactly should they appear in the output? Can there be more lines than header entries? And if so, do you loop them, or what? Etc.
In short, give us an actual example of the input and the desired output, and explain in detail how they relate to each other.
And please use ***[code][/code] tags*** around all of your code and data, to preserve formatting and to improve readability. Please do not use quote tags, bolding, colors, or other fancy formatting.
High David, thank you for your sound post on what is needed to help solve my problem and some formatting.
Unfortunately I can not post an actual data file because it is held on a LAN. I'll try to do a better job describing my input data file. It's a standard csv data file that could easily be read into excel and then do a transform (using excel) on just the first row, but my computer only has linux. Here's just an example representing what one of the data files looks like.
so it's just one row of header fields, delimited by comas, and then the data is also delimited by comas. The number of rows of data can be in the thousands. Some of the files will have 12 columns and some of them have 21, some 54, and some 66. They're all different. Because they are all different, it would be really good if I had a listing of how many fields are in each file and what's in each field. Because the number of columns can also be pretty large (like 66) I think that a row to column transform on just the first row would be really good. It would also be really helpful to have an index value placed next to the header field. So an output file might looks like:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.