Hello everyone, Im super new to coding but increasingly in need of it at work. Im have task stacked because of this problems, that I cannot figure out how to solve looking on the internet after trying many many things that looked similar to me.
I have multiple data files of the form (see below).
My question is how can I copy the two columns with the size and rotation data, which is the only one that I need from the file. And then how to do that for several (1000) data files like this.
Thank you very much in advance
text text text text text
text texttexttexttext texttexttext
text text text text text text
X=size
Y_rotation
45.000000 87.611985
47.812500 85.219808
42.187500 85.219808
45.000000 82.819244
50.625000 82.819244
other text other text other text
other text
When starting a new thread here, please always tell us what operating system and shell you're using. Various utilities behave differently are different BSD-, Linux-, and UNIX-systems and various shells provide features that do not appear in all shells. If we don't know what environment you're working in, we are likely to make suggestions that work fine for some of us, but won't work in your environment.
Please show us in (Code tags) what you have tried and explain what parts of that worked for you and what parts fell short.
Are the lines that you have shown us in your example:
X=size
Y_rotation
literal text, or is the X= literal text and the size a place holder for a numeric string. And, is it really an underscore character in Y_rotation or should it also be an equals sign? And is the rotation literal text or a place holder for another numeric string.
Could either of those lines appear elsewhere in what you have shown in your example as text and othertext ? Could lines you have shown as text in your example ever start (possibly following leading spaces or tabs) with a numeric character?
Exactly what output are you hoping to produce from the example you have shown us?
Can multiple occurrences of the tabular data you have shown us appear in a single file? If so, how should that affect the output you want?
What you need is a parser. I doubt you can find one that answers exactly your need because we have not a universal parser and every one has a particular data file format.
So, in a first time, you must write a parser for one file, than you can make it process all the files in a directory.
Parsing, in this case, is basicaly, String processing, you will your file line after another until the begining of data and stop when the data end.
Very difficult to talk about it without specifying additional informations about the file or the programing language.