I have a problem reading in the following file or separating the columns cleanly.
I have tried with FileReader, File Reader (complex Format).
Hide first lines etc.
The only solution I can think of is the Fixed Witdh File Reader, but it is not a nice solution.
Does anyone have any idea?
Ich habe ein Problem dabei die folgende Datei einzulesen bzw. die Spalten sauber zu trennen.
Ich habe es mit dem FileReader, File Reader (complex Format) versucht.
Einzige Lösung die mir noch einfällt ist der Fixed Witdh File Reader,
Hat jemand eine Lösung?
the Fixed Width File Reader would be the best and imo only solution.
This should be followed by a “strip” function using the String Manipulation and Number to String (if necessary for specific columns).
Hope that helps
recently I had the same issue. The problem was that headers and data rows did not align. For me it worked as follows:
- Use the File Reader to read the file into one single column. Make sure to use ISO-8859-1 encoding and limit the rows to the data by skipping the first two rows.
- Use the Cell Splitter By Position to separate columns. In my case, setting indices to “5,14,23,38,50,60,101” and column names to “station_id,start,stop,station_height,lat,lon,name,state” worked well.
- With String Manipulation (Multi Column) you can strip() whitespaces.
Looks like it works.
Thanks for your help, learned a lot again
here is another way using Line Reader and splitting on whitespace after which you use couple of manipulation nodes to get correct Bundesland and Stationsname. Useful if column position indices might change or you are lazy to count or for future data import
Here is example. Take a look and if any questions feel free to ask. Welcome to KNIME Community!
2021_11_02_Column_Separating.knwf (28.0 KB)
Thanks again for the help and the kind reception. Both ways work.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.