Chemist Needs Help


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Chemist Needs Help
# 8  
Old 10-23-2008
Quote:
Originally Posted by jim mcnamara
Are the values for the now-dummy 42 and 69.42 column also in the same file we are using to drive input?
No the dummy numbers will be from individuals files. For example my awk command will be run on three different files. Each file will correlate to each column. thank you Lenny
# 9  
Old 10-23-2008
The numbers form the other files are just one single value or are they a column in the file?
# 10  
Old 10-23-2008
Quote:
Originally Posted by jim mcnamara
Are the values for the now-dummy 42 and 69.42 column also in the same file we are using to drive input?

Sorry I suck at explaining:

The second column I use the awk command to filter through a large file i have and pull out 101 numbers that are two delimitters after the word "Done" .

The third and fourth I use the same awk command but it does only pull out one value per file. That value I need to repeat 101 times. For column 3 and 4. Column three will get one value from "file2" and column 4 will get one value from "file3". Hope that helps. Lenny
# 11  
Old 10-23-2008
Try this - you still need to edit filenames
Code:
awk '/Done/ {print $2; exit}'  file3 | read col3
awk '/Done/ {print $2; exit}'  file4 | read col4

printf "%s\n%s\n%s\n%s\n" "comment" "x y x"  "101"  "4 7" > newfile

awk '/Done/ {print $2}'  file | \
 awk -v col4="$col4" -v col3="$col3" ' BEGIN { cnt =1.5 }
         {printf("%.1f  %s  %s %s\n", cnt,  $0, col3, col4); cnt+=.1 } >> newfile

# 12  
Old 10-23-2008
Quote:
Originally Posted by gingburg
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.
You can always make a big donation to the forums if you are pleased with your results here Smilie

The UNIX and Linux Forums - PayPal Donate
# 13  
Old 10-23-2008
Quote:
Originally Posted by jim mcnamara
Try this - you still need to edit filenames
Code:
awk '/Done/ {print $2; exit}'  file3 | read col3
awk '/Done/ {print $2; exit}'  file4 | read col4

printf "%s\n%s\n%s\n%s\n" "comment" "x y x"  "101"  "4 7" > newfile

awk '/Done/ {print $2}'  file | \
 awk -v col4="$col4" -v col3="$col3" ' BEGIN { cnt =1.5 }
         {printf("%.1f  %s  %s %s\n", cnt,  $0, col3, col4); cnt+=.1 } >> newfile

I get this message:

../bin/Lenny: line 7: unexpected EOF while looking for matching `''
../bin/Lenny: line 9: syntax error: unexpected end of file
# 14  
Old 10-23-2008
Code:
cnt+=.1 } '  >> newfile    # <---  last line of code

Typo. My bad.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Chemist Needs Help part II

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)
Discussion started by: gingburg
5 Replies
Login or Register to Ask a Question