Different number of lines in fieldfile and li

May 7, 2011 at 14:07:53
Specs: Windows XP
i run the script ./billy
and when reaching the routines
# Write lines on which asterisks occur to linefile:

if (`grep -c '\*' $file` != 0) then
awk '/\*/{print NR}' $file > linefile
set numlin = `awk 'END{print NR}' linefile`
awk '/\*.+\*/{print NR}' $file >> linefile
awk '/\*.+\*.+\*/{print NR}' $file >> linefile
set a = 1

# Write fields in which asterisks occur to fieldfile:

while ($a <= $numlin)
set line = `awk 'NR=='$a' {print $1}' linefile`
awk 'NR=='$line' {for (i=1 ; i <= NF ; i++)\
{if ((index ($i,"*")) == 1)\
{print i >> "fieldfile"}\
}\
}' $file
@ a = ($a + 1)
end
set numast = `awk 'END{print NR}' linefile`
set numast_check = `awk 'END{print NR}' fieldfile`
if ($numast_check != $numast) then
echo "Different number of lines in fieldfile and linefile."
echo "Check that your parameters have been asterisked correctly."
echo "Otherwise this may be a bug in the billy script."
exit
endif
i get the the error message:
Different number of lines in fieldfile and linefile.
Check that your parameters have been asterisked correctly
Otherwise this may be a bug in the billy script.
can i hope a help?thaks for all


See More: Different number of lines in fieldfile and li

Report •

#1
May 8, 2011 at 16:51:40
That looks like a valid error message. Can you provide more information on just what your error is?

I do have some comments:

1) In your csh script, I see two if statements, but only one terminating endif. Could that be causing you a problem?

2) Your while loop syntax is incorrect:

while [ condition ]
do
	command1
	command2
	commandN
done

You are missing a "do" clause.

3) I guess it's OK to use awk to find the total number of lines in a file:

set numlin = `awk 'END{print NR}' linefile

But it is more efficient to use the wc command:

set numlin = `wc -l < linefile`


Report •
Related Solutions


Ask Question