For example, there are such strings in the file:
A.txt
Rei9aiwe bohth4Zu Go3eimum iChieSh5iveeSh2J eiziV0bo lu2Efooz feey5Ohr
To convert into the following situation:
B.txt
Rei9aiwebohth4ZuGo3eimumiChieSh5iveeSh2JeiziV0bolu2Efoozfeey5Ohr
How to do?
Language is not limited, Php/ruby/python can.
Reply content:
For example, there are such strings in the file:
A.txt
Rei9aiwe bohth4Zu Go3eimum iChieSh5iveeSh2J eiziV0bo lu2Efooz feey5Ohr
To convert into the following situation:
B.txt
Rei9aiwebohth4ZuGo3eimumiChieSh5iveeSh2JeiziV0bolu2Efoozfeey5Ohr
How to do?
Language is not limited, Php/ruby/python can.
sed 's/\s\+/\n/g' a.txt > b.txt
Or
tr ' ' '\n' < a.txt > b.txt
or in Python:
python -c 'open("b.txt", "w").write(open("a.txt").read().replace(" ", "\n"))'
Such a task, more than a line of code is really too wasteful.
Since the language is not limited, to an alternative, visual inspection not a few know what language
Import["a.txt"]~StringReplace~(" " -> "\n") // Export["b.txt", #] &
Add a ruby version
open("b.txt", "w").puts open('a.txt').read.gsub " ", "\n"
Python
myfile = open("a.txt")temp = ""for line in myfile.readlines(): for a in line.split(): temp += a + '\n'myfile.close()file_object = open('b.txt', 'w')file_object.writelines(temp)file_object.close()