Skip to main content
Solved

Parse Text File data into columns

  • November 8, 2024
  • 5 replies
  • 233 views

rbrown
Contributor
Forum|alt.badge.img+3

I’m fairly new to FME and need help to get started on a workbench. I have a text file i need to convert into a readable format. Each line has information about a specific device and should be parsed into separate columns. The blank spaces also need to be removed. What transformer should I use? Any help is appreciated!

Best answer by ebygomm

Another option is to use a CAT (Column Aligned Text) Reader

This will eliminate the blank spaces without anything further required

View original
Did this help you find an answer to your question?

5 replies

danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • November 8, 2024

Hi @rbrown 

 

Do you have a sample data to share?

 

Remove blank space I suggest you to use the transformer AttributeTrimmer.


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • November 8, 2024

Use a CSV Reader instead.   It will parse any text file by any custom Delimiter character input into the Parameters.  The sample preview looks like a space or Tab character is used.

It sometimes needs some trial and error with the Advanced Parameter settings, but it should give you what you want.  One Parameter to be careful of is “Scan for Type” is left as “Yes”.  If it determines the column is numeric, it will drop the leading zeros on this column, and can see that you do have these types of fields in the sample data.


rbrown
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • November 8, 2024

@bwn , that worked. Thank you! The txt file did not have headers so I also had to set the 'Field Names Line' setting to None.

 @danilo_fme thanks for your suggestion too! I’ve attached a copy of the data if you’d like to use it. 


danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • November 9, 2024

Hi @rbrown 

 

Thanks for your data.

 

I created a Workspace that eliminate these blank spaces and generate a attributes.

 

Attached.

 

Thanks, Danilo!


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • November 11, 2024

Another option is to use a CAT (Column Aligned Text) Reader

This will eliminate the blank spaces without anything further required


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings