Computing.Net > Forums > Linux > why this does not work

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

why this does not work

Reply to Message Icon

Name: yacob
Date: October 7, 2008 at 17:44:51 Pacific
OS: Linux
CPU/Ram: 2GB
Product: linux
Comment:

I was trying to use the script below:

number_of_lines=1
number=1

until [ "$number" -gt "$number_of_lines" ]
do

echo $number

awk '{ if (NR == $number) print $1, $2, $3, $4 }' file_input

expr $number + 1 > temp_number
read number < temp_number
done


when I echo $number it gives me 1,2, 3
.... so on but with the comparison if (NR == $number) I was expecting the awk command would print the first record of the file_input. But I do get nothing.

Any comments, please



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: October 7, 2008 at 18:57:36 Pacific
Reply:

Learn your quotes.

Try:

awk "{ if (NR == $number) print \$1, \$2, \$3, \$4 }" file_input


0
Reply to Message Icon

Related Posts

See More


how do you install damn s... linux os for an old Amd k...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: why this does not work

ModelSim on Linux SuSe 7.3 does not work www.computing.net/answers/linux/modelsim-on-linux-suse-73-does-not-work/11254.html

Opera Anti-aliasing does not work. www.computing.net/answers/linux/opera-antialiasing-does-not-work/14644.html

Sound not working www.computing.net/answers/linux/sound-not-working/15850.html