Hello All I am a chemist and really dont know too much about programming but here goes.
Essentially I need to create a script that I can run which will do the following.
Create a file where the first four lines are a set of commands that are the same for all the files. E.g
ln1: comment
ln2: x y x
ln3: 101
ln4: 4 7
So the script should print those line into a new file first.
Then i need to make 4 columns.
The first I need to be 1.5 +0.1 100 times.
e.g.
1.5
1.6
1.7
1.8
1.9
etc.
The second column I need to be a column of data which I have used the command awk '/Done/ {print $2}' file
There will be 101 numbers extracted
Note: I would like Done and the number to be a variable to input in the command line.
The third and fourth are the same as the second except there will only be one point that I need to repeat 101 times.
If someone could help me that would be amazing. Also if someone is an expert I will pay them via paypal to help me occasionally. Thank you Lenny.
Well, you're short on exact information, so my attempt is generalized. It also isn't all that efficient. I picked 42 and 69.42 as the two fixed numbers.
Well, you're short on exact information, so my attempt is generalized. It also isn't all that efficient. I picked 42 and 69.42 as the two fixed numbers.
Jim, the first part is perfect. I will try to explain the columns a little better.
I need 4 columns:
The first should be 1.5 through 11.5 by 0.1 increments.
The second column will have 101 15-digit numbers which I have previously extracted with the awk command. The first 15-digit number should be in the same row as 1.5
The third column will have one 15 digit number that I will use the same awk function to retrieve with as i did before. But since I only have one number i need to repeat it 101. The same goes for the fourth.
The code above will work for you - plugin correct values for the red text below:
Keep all quotes and punctuation characters as they are. They have meaning. Just use alphanumerics and . for a decimals and +- for signs on numbers if needed. File names cannot contain spaces or weird characters.
The number of rows you create in the output file is totally depdendent on the number of rows you read in via the first awk statement. ie., the number of lines read in from "file". Nothing is doing any counting for you. If you don't get 101 lines look to your input data.
The code above will work for you - plugin correct values for the red text below:
Keep all quotes and punctuation characters as they are. They have meaning. Just use alphanumerics and . for a decimals and +- for signs on numbers if needed. File names cannot contain spaces or weird characters.
The number of rows you create in the output file is totally depdendent on the number of rows you read in via the first awk statement. ie., the number of lines read in from "file". Nothing is doing any counting for you. If you don't get 101 lines look to your input data.
Okay everything seems good but the values 42 and 69.42 also need to be extraced using the same awk command how do I put that command in there. Lenny
Hello friends,
I was wondering if you can help me with probably a simple function to you all: the sample looks and has this format. I was wondering how I could extract the first and second column starting including the line 'E/N and Ko' and not stop until there are no more lines. Thank you for... (5 Replies)