for (( int i="$4"; i<"$5"; i++ ))
do
awk "NR==i{print}" $1
done
I want awk to print out the records between $4 and $5 ( itll be a range, ie 4-9 )
cant figure out why im getting this error?
Syntax error in expression ( error token is "i=2" )
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
awkdoesn’t know anything about the shell variablei, for a start, Why would you just not use:The shell itself should expand the
$variables since they’re within double quotes rather than single quotes (this is shell-dependent of course but covers the most popular ones, primarlybash).You can see this in action in the following transcript: