Columns in textfile merged, how to add space inbetween? (coordinaates)
Hello!
I have a problem with a text file containing atom coordinates. After a converting step using some software, the structure of the textfile got a little messed up. Some columns merged, because the numbers got too large. My text file has 119’000 lines like:
If the textfile looks normal (see below), I can use “awk” to extract each column with coordinates (column 3, 4 and 5) into a new text file to manipulate them further using excel. (I calculate the mass center of all atoms)
Ordinary part of the text file (note that there are spaces between the coordinates, that’s what I need):
As I already mentioned, some lines merged and can look like this:
It can also have different numbers of digits/letters between the messed up lines (simple positional approach does not work).
Does anyone know, how to either get a space at the right place or still extract the numbers, even though they are not separated into columns anymore?
I am new to UNIX and I am already seeing me entering spaces for 5-10h.
Additional Information:
-The numbers after “POPC” go from 1-239 for 501 times.
-sample_coordinates.txt attached
-The order of the listings can not change (only within the POPC1-239 section that repeats, the order does not matter)
-This is no homework or course assignment.
Thank you so much, it looks like it worked! I really need to learn the sed command, it's so powerful!
Do you just add a space before the last "-" in the line? I'm curious on how this worked.
HI All,
I'm embedding SQL query in Script which gives following output:
Assignee Group Total
ABC Group1 17
PQR Group2 5
PQR Group3 6
XYZ Group1 10
XYZ Group3 5
I have saved the above output in a file.
How do i sum up the contents of this output so as to get following output:
... (4 Replies)
My first post, so don't kill me :)
Say i open some textfile with some example like this.
on the table are handy, bread and wine
Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this:
table
plane ... (3 Replies)
Hi all, I know this sounds suspiciously like a homework course; but, it is not.
My goal is to take a file, and match my "ID" column to the "Date" column, if those conditions are true, add the total number of minutes worked and place it in this file, while not printing the original rows that I... (6 Replies)
How can i make a script to add text before the first word on a line in a textfile :
Example:
Old line:
is my place
New line:
this is my place
Please use and tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. (3 Replies)
Hi all,
I have created a script which adding two columns and removing two columns for all files.
Filename: Cust_information_1200_201010.txt
Source Data:
"1","Cust information","123","106001","street","1-203 high street"
"1","Cust information","124","105001","street","1-203 high street"
... (0 Replies)
Hi all, i am writting a script to fix some problems we have with data that we need that contains 1000s of records. I have a text file with 3 columns of data. The problem is there should be a space between the end of the first column and the start of the second column. The majority of the data is... (7 Replies)
We recieve some logs on our windows box via FTP on a daily basis, in the same directory. I would like to check for missing logs files and add their name to a text file.
Something like...
Check if C:\logs\file1_currentdate exists (if not, add file1_currentdate to... (1 Reply)
Hi,
I am trying to add space after 3rd and 6th column for editing a file in special format. How should I achieve in VI?. So, is it possible to do in it in sed ?
thanks
vipa (1 Reply)
I have a program that calculates shipping cost for an item and prints the information to a file. I cannot seem to get the lines to print with equal spacing in columns.
I need data like this to be aligned into columns:
Optical Mouse 5 A $25
Compaq Presario 3... (2 Replies)