Hello friends,
I have text file which contains more than million phone numbers.
Here is the example. I want to extract all numbers and put it in a excel single row file.

07748362656 07532517142 07946132831 07532135934 07880531707 07816820456 07879181057 07928483273 07735721101 07668889152 07925787076 07041438421 07524774407 07948383594 07927231600 07796044906 01679953124 01615331860 07717569470 07047049480 07838966541 07751578579 07972438550 07659413272 07547510448

Can anyone help me?.
thanks

I do not think a single row (across) will work but you put them in a single column (down the page) with this from the command line of a bash shell:

for x in `cat myfile`
do
echo $x >> newfile.txt
done

The for loop will treat the spaces as a delimiter. When you hit enter at the end of the first line the second line will prompt you with a > symbol which will continue till after you type done.

Will that work?

The real question is "Why do you want a million numbers in your excel file?" Excel probably can cope, but as long as you are handling the file now, why not do some work on the information before you write it back out? You can use (g)awk to do really quite interesting things: Average of all the numbers above, or below some cut off point, as an example; or a count of numbers in each of various ranges; or sort the numbers (that might be somewhat troublesome for that many numbers). If you are willing to use some other language (Perl, Python, Mathmateca, Maple, C or C++, ...) to handle it, you can (more easily) do even more fascinating things without ever invoking excel.

Comments
You're so right! Loved to read your post!

Hello friends,
I have text file which contains more than million phone numbers.
Here is the example. I want to extract all numbers and put it in a excel single row file.


To put them all on one line:

tr '\n' ' ' < "$file" > "$newfile"
This article has been dead for over six months. Start a new discussion instead.