awk 'NR> 92239 && NR<= 92279' /usr/appplications/access.log
is there a reason why the above command isn't working on kubuntu?
when i run it, i get nothing back. just the prompt. i should see the lines
OS:
3.8.0-19-generic #30-Ubuntu SMP
and yes, there are over 92279 lines in the log. i'm befuddled. any help here is appreciated.
RudiC
July 12, 2013, 10:02am
2
Seems good to me. Did you try parentheses around the inequatons?
1 Like
not sure how or where to put the parentheses.
Try FNR as well, you have GNU awk (gawk). The parens go around the statement to be evaluated as a boolean.
'(FNR>111 && FNR<113) {print}' filename
1 Like
It won't print anything if /usr/appplications/access.log has got less than 92239 lines.
1 Like
I think Ubuntu uses mawk by default, actually.
1 Like
skysmart:
awk 'NR> 92239 && NR<= 92279' /usr/appplications/access.log
is there a reason why the above command isn't working on kubuntu?
when i run it, i get nothing back. just the prompt. i should see the lines
I also do not see any problem with that awk script.
For diagnostic purposes, does the following command produce the expected output?
sed -n '92240,92279p; 92279q' /usr/appplications/access.log
Regards,
Alister
1 Like
Yes, Debian and downsteam use mawk by default.
1 Like
alister:
I also do not see any problem with that awk script.
For diagnostic purposes, does the following command produce the expected output?
sed -n '92240,92279p; 92279q' /usr/appplications/access.log
Regards,
Alister
this is what i ended up using. i'm kinda disappointed that the typical awk couldn't work on ubuntu as it works and other linux/unix oses.
FWIW, in later versions of Ubuntu the default awk
became gawk. In this version (13.04) probably gawk 4.01
You could try running the command as:
mawk 'NR> 92239 && NR<= 92279'
to see if that makes a difference..
1 Like
Actual Debian Testing (Jessie) also uses gawk after a "standard system" install.
You still get mawk if you choose to not install the "Standard system" at Tasksel install step.
1 Like