LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-11-2013, 08:28 AM   #1
SureshM
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
awk different outputs each time


I have a strange issue.

Code:
(awk '$3 == "nfs" { cnt++ }; END { print cnt }' /etc/fstab)
This is giving different count each time.


To test this, tried the one here
Code:
-bash-3.2$ awk '/nfs/{print $2}' /etc/fstab | wc -l
151
-bash-3.2$ awk '/nfs/{print $2}' /etc/fstab | wc -l
145
-bash-3.2$ awk '/nfs/{print $2}' /etc/fstab | wc -l
150
checking the output, it has all wired outputs each time, since command was searching for "nfs", it is giving all non matched strings. output were always different.

do
/boot
/tmp
/var
none
/dev/pts

The same script is working on all other 100+ machines, only one machine is showing the wired stuff.
any ideas/thoughts ?
 
Old 04-11-2013, 08:40 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
What is the output of the following command (on the box that has this issue):
Code:
file /etc/fstab
 
Old 04-11-2013, 08:57 AM   #3
SureshM
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
druuna :

ASCII text

its not an issue with file type, its happening with every file

Code:
552
-bash-3.2$ awk '/bash/{print $1}' /etc/passwd | wc -l
556
-bash-3.2$ awk '/bash/{print $1}' /etc/passwd | wc -l
552

-bash-3.2$ awk '/nfs/{print $1}' /proc/mounts | wc -l
147
-bash-3.2$ awk '/nfs/{print $1}' /proc/mounts | wc -l
145
 
Old 04-11-2013, 09:33 AM   #4
SureshM
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
tried reinstalling the gawk-3.1.5-14.el5 too, didnt help.

found that it works fine in "csh", all others are failing
 
Old 04-11-2013, 09:45 AM   #5
SureshM
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
no,its fails on csh too
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Installing Perl outputs some errors and build time isn't as long as indicated. luckylinuxluser Linux From Scratch 25 02-23-2013 10:42 AM
how many files can awk handle at a time? iconig Linux - Newbie 4 08-03-2012 11:59 AM
Array in awk outputs multiple values kristo5747 Linux - Newbie 1 11-09-2011 10:27 PM
Real time management of audio inputs/outputs? Jeff91 Linux - Software 9 06-23-2010 03:05 PM
Good time to use AWK? VeeDubbs Linux - General 9 03-13-2009 10:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration