I am carrying out a research project for which I need to do quite a lot of calculations. I basically calculated a lot of features for structures present in a .sdf file. I automated the entire process and carried it out in the terminal of my mac.
The thing is, there are over 48 rows and about 1500 columns. Manually typing in the data to an excel sheet would be a very strenuous task. I was wondering whether there was any way to directly save all the data into an excel sheet or not.
Whether it is sorted out or not does not matter. I think that the effort put into sorting a file will be quite less than manually making one.
It is being outputted as numbers separated by an indentation. For example,
(9613791) 2.69174 4.00454 4.2916 6.25497 6.65652 6.5094 5.18009 5.15649 5.823377.19567 8.21786 6.99439 16.2414 30.3753 30.6785 32.3146 30.0467 51.6735 25.142149.4748 51.7923 42.1594 52.7151 36.7925 1385.6 2004.66 2277.51 2055.07 2273.911577.31 996.44 2300.92 1986.91 1913.57 1486.7 2496.63 2.45285 3.78492 4.502884.55984 2.82045 2.75078 1.31798 4.53201 4.57725 3.39381 2.39053 3.80041
(6326464) 6.14815 5.46639 4.81788 6.00802 10.6837 8.52504 7.72782 8.05056 8.8713412.2334 12.8092 7.97405 20.3998 18.8032 25.2747 31.2464 33.5688 42.0236 25.741528.9837 33.9351 40.8985 47.1114 31.8816 752.681 1090.84 1049.61 953.366 1405.21942.868 876.854 1345.75 1178.31 1467.03 1395.57 1371.48 2.67685 3.35145 5.508316.20868 5.91418 4.43033 3.44952 6.23538 5.99355 6.30963 7.03768 6.14026 `
Note: This just a small snippet of the actual output. I could not post the image until I got 10 points. I need to get the data between the two numbers that I put a bracket between in one row. The next row starts from the second number that is between the brackets. There are basically around 1500 columns of such data. As suggested by @deceze in a comment, I will try to alter my program to implement a function that automatically save the data. But is there an alternative method that can help me expedite the process without trying to make changes to my program?
Imagine your mysterious program is called fred
and you run it by typing
./fred
in the Terminal. Now, you can make the output get sent into a file called file.txt
by running it like this:
./fred > file.txt
Now, you can copy the first 10 lines of the file by running this command:
head -10 file.txt | pbcopy
and then click edit
under your question and paste (with Command-V) those first 10 lines in so we can see what you are talking about.
If you just want the first number of every line in that file put into a CSV
file called lovely.csv
you can do this:
awk '{print $1}' file.txt > lovely.csv
If you want the 9th column from every line, change the $1
above to $9
.
If you want the 1st, 2nd and 4th field, use
awk '{print $1,$2,$4}' file.txt > lovely.cv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With