Skip to main content
Question

Manipulate text data within a txt

  • April 28, 2017
  • 1 reply
  • 5 views

Forum|alt.badge.img

Is it possible to manipulate text to conform to a standard if each line varies slightly?

As you can see in the converted format I deleted the first 6-8 characters at the beginning of each line, removed some spaces and replaced with semi-collins some with commas, and added some ID at the end.

This is currently done manually with a beefed up Notepad but I would like to feed the txt into a transformer to complete this.

existing format

4 SDWP SAXEL FB N 47 58 46.1498 W 066 15 38.3245

5 FAWP TAVLU FB N 47 58 20.4669 W 066 13 02.6285

6 IWP GONEX FB N 47 56 54.2098 W 066 04 22.6074

7 IAWPL MATAX FB N 47 51 26.2613 W 066 03 30.7522

converted format SAXEL,N47:58:46.1498,W066:15:38.3245,16-05361 TAVLU,N47:58:20.4669,W066:13:02.6285,16-05361 GONEX,N47:56:54.2098,W066:04:22.6074,16-05361 MATAX,N47:51:26.2613,W066:03:30.7522,16-05361

1 reply

takashi
Evangelist
  • April 28, 2017

Hi @tlabs, if the number of parts is identical for every line when you split them by whitespace, the combination of AttributeSplitter and StringConcatenator could be a quick solution.

AttributeSplitter

  • Delimiter or Format String: <space>
  • List Name: _list

StringConcatenator (String Expression)

@Value(_list{2}),@Value(_list{4})@Value(_list{5}):@Value(_list{6}):@Value(_list{7}),@Value(_list{8})@Value(_list{9}):@Value(_list{10}):@Value(_list{11}),16-05361

Result

0684Q00000ArKxrQAF.png


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