2

I have a txt file like this:

A   B C
400 2 3
2   1 8

Now I would like to import the txt file and write it all on one line instead of in columns, so like that:

A B C 400 2 3 2 1 8

How can I achieve this with Mathematica ?

james
  • 3,043
  • 13
  • 29

1 Answers1

2
StringRiffle[ReadList["C:/temp/temp.txt", Word], " "]
Alan
  • 13,686
  • 19
  • 38
  • This is great ! Thanks a lot !! – james Aug 15 '18 at 10:41
  • @Alan, if the input txt is: ABC 123 BCD 234 EFG 345,output I need is 123 234 345, how can I do in MMA? – ABCDEMMM Nov 01 '18 at 01:52
  • New questions should be created as a new question. Anyway, the Mma documentation for ReadList and Part are excellent; start there. E.g., ReadList[StringToStream@"ABC 123 BCD 234 EFG 345", {Word, Number}][[All,2]]. – Alan Nov 01 '18 at 13:03