Unfortunately, I need to run this script under csh (or I have to convert a lot of other code too), BUT this does give me some good ideas about where to go from here.
Thanks so much!
I tried previously, but couldn't figure out a better solution using awk as the line numbers between each @<TRIPOS>molecule separator vary, as do the number of entries in the file.
I'll go back and try again though.
I have a rather long csh script that works, but it's terribly ungraceful and takes a while from various loops. I only know enough code to get myself into trouble, so I'm looking for some guidance.
I have a large file that is separated at regular intervals by the same line, like this...
My apologies for the incorrect thread title. I'm still very new to this and thought I was having problems passing more than one 'shell' variable into my awk string.
What would a more appropriate summary of the problem be? Any ideas on how to fix it?
Thanks!
Hi!
I'm having some problems getting AWK to use more than one variable from the shell. In a long bit of code I have the snippet:
suf=00"$i"
molwsuf="$molname"_"$suf"_hbond
h=`cat $molwsuf`
gawk '/'"$molname"_"$suf"'/ {print '"$i"', $2, $4, $6, '"$h"'}' $logfile >> $filename
Where i is an...
Well, that would sure explain why I couldn't get anything to work prior! :)
That fixes the biggest problem I was having (which are usually the silliest ones).
Thanks so much!!
I hadn't tried the eval version.
Both of them, when run from the command line, will set the variable correctly. However, when I put either one in a shell script and run it, it still doesn't set the variable, claiming it to be undefined when I try to echo it afterwards.
Hi! I'm reasonably new to awk and shell scripting, and am having difficulties with getting my shell script to set an environment variable based on the awk output from within a shell. I need to be able to reset the variable for each pass of a loop.
Basically, I fetch the name from a file using...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.