similar to: Need help with awk one-liner

Displaying 20 results from an estimated 10000 matches similar to: "Need help with awk one-liner"

2008 Feb 28
1
Find user accounts with uid > 500
Hi all: I'm doing an audit of some Linux machines, and have used this awk one-liner to find accounts with uid > 499: awk -F: '{if ($3 > 499) print $0}' < /etc/passwd It works great if you run it on a host directly, but if I try to ssh to a remote host and run the command it fails: mybox$ ssh servername awk -F: '{if ($3 > 499) print $0}' < /etc/passwd bash:
2008 Aug 11
4
df to get total disk usage on all filesystems?
Is there a flag for the df command to get the total disk space used on all filesystems as one number? I have a server with a lot of mounted shares. I'm looking for a simple way to measure rate of data growth across all shares as one total value.
2009 Jun 24
4
More awk help
Hey guys, Looking through my book and the web and I am not having any success returning data from a search. I need to have awk search for a string and print the first field which is no problem but now its returning two options as the input data has changed. The change is reliable, I only want the first field if it ends in a regex that I have, and I only want what that regex matches to be printed.
2012 Jun 28
4
Optimizing grep, sort, uniq for speed
This snippet of code pulls an array of hostnames from some log files. It has to parse around 3GB of log files, so I'm keen on making it as efficient as possible. Can you think of any way to optimize this to run faster? HOSTS=() for host in $(grep -h -o "[-\.0-9a-z][-\.0-9a-z]*.com" ${TMPDIR}/* | sort | uniq); do HOSTS+=("$host") done
2010 Mar 26
3
awk global replacement only after keyword
Trying to avoid a perl script which wouldn't be hard, but I am looking for an awk one liner that does a replacement, but only after it sees a key word on some line. Anyone know of that's easy to do? Thanks! jlc
2008 Feb 05
4
Enterprise-class monitoring system for CentOS and Win2k3 server
Can anyone recommend an enterprise-class monitoring system for both Linux and Windows servers? Here are my requirements: SNMP trap collection, ability to import custom MIBs isup/isdown monitoring of ports and daemons Server health monitors (CPU, Disk, Memory, etc) SLA reporting with nice graphs Pager/Email/SMS alerts with groups, filters and escalations Built-in MTBF and MTTR reporting Robust
2008 Jan 10
4
Howto for LDAP authentication with replication
Can anyone point me to a how to or beginners guide to setting up LDAP authentication on CentOS5 with replication?
2008 Jun 10
4
Apache jserv monitoring?
In our environment we have many legacy application servers running apache/jserv. There is a web server front end, then a couple of load-balanced java servers on the backside. One of the problems we are faced with is hung or stuck jvms. I have looked at the java process with the ps command, and there are many times when URL(s) do not respond, yet the java looks healthy, at least from the OS
2012 Dec 06
2
awk awk
a little out of my comfort zone and have practically gotten what I want but awk seems determined to send a message via std error which is problematic and annoying. Basically trying to get a list of virtual host names from nginx config files like this: $ awk -F" " '/./ { if ( match ( "^server_name$", $2 ) ) print $1 }' /opt/nginx/sites/*.conf \ | grep -v server_name |
2019 Oct 31
1
[PATCH] Replace mkproto.pl with mkproto.awk
> I can't speak for rsync, but nowadays Perl isn't that rare, that a > dependeny on it for build purpose would matter. IMHO. It might not be rare, but it's certainly less universally available than awk, which is preinstalled on pretty much every unix-like OS out there. > There are many flavours of AWK. Are you sure, that your AWK replacement > runs everwhere? I tested
2019 Oct 31
5
[PATCH] Replace mkproto.pl with mkproto.awk
This replaces the build dependency on perl with one on awk which is already used in the build system and is much more ubiquitous than perl --- Makefile.in | 2 +- mkproto.awk | 39 +++++++++++++++++++++++++++++++++++++++ mkproto.pl | 48 ------------------------------------------------ 3 files changed, 40 insertions(+), 49 deletions(-) create mode 100644 mkproto.awk delete mode 100644
2007 Oct 26
6
script help
Hi I am sure the answer here is really easy but i am stuck! # mount | grep data | awk '{print$1,$2,$3}' gives me the info i require locally, however i need to execute this over about 1000 hosts so i run things remotely using ssh something like # MOUNTER=`ssh $i 'mount | grep data | awk '{print$1,$2,$3}''` however this fails as at the end of the line there are 2 ticks
2007 Jun 13
3
Awk and Vilno
In clinical trial data preparation and many other data situations, the statistical programmer needs to merge and re-merge multiple input files countless times. A syntax for merging files that is clear and concise is very important for the statistical programmer's productivity. Here is how Vilno does it: inlist dataset1 dataset2 dataset3 ; joinby variable1 variable2 where ( var3<=var4 ) ;
2008 Jun 23
2
Awk help
I have csvde dump from active directory I process on my postfix mta. It takes output like this: "CN=Curtis xxx,OU=Domain Users,OU=xxx xxx,DC=xxx-xxx,DC=local",X400:c=US\;a= \;p=xxx xxx xxx\;o=Exchange\;s=xxx\;g=xxx\;;SMTP:Cxxx at xxx-xxx.com and should return a relay_recipient map in the form of: Cxxx at xxx-xxx.com OK The command I am using is: cat $1 | tr -d \" | tr , \\n|
2014 Nov 30
4
awk vs. mawk
On Nov 26 22:39:27, hans at stare.cz wrote: > ./test_replaygain.sh fails for me in tonegenerator(), saying: > > ./test_replaygain.sh[91]: mawk: not found > Testing FLAC replaygain 8000 (8000 x 1) ... -: ERROR: got partial sample > > Apparently, the tone-generating awk script does not work with > my system's awk, which is "awk version 20110810" as distributed
2016 Apr 29
2
Semi-OT: awk
This is odd, and annoying. CentOS 6, current. Here's my awk script: { room = substr($0, 48, 10); arr[$2,room,$1] = $0; } END { for ( i in arr ) { for ( j in arr[i] ) { for ( k in arr[i][j] ) { print arr[i][j][k]; } } } } And when I run it, it complains awk -f awksort proplist7 awk: awksort:7: for ( j in arr[i] ) { awk: awksort:7:
2014 Dec 11
2
awk vs. mawk
On Dec 10 23:04:44, mle+la at mega-nerd.com wrote: > Definitely interested in a cross platform solution to this. Diff below. Please test. On Dec 03 13:21:16, hans at stare.cz wrote: > On Nov 30 14:33:47, hans at stare.cz wrote: > > On Nov 26 22:39:27, hans at stare.cz wrote: > > > ./test_replaygain.sh fails for me in tonegenerator(), saying: > > > > > >
2009 Dec 15
2
Define an alias with an embeded awk command
Hi ,all : I'm trying to define an alias with an embeded awk command: alias checketh0 `ifconfig eth0 |grep 'inet addr:' |awk '{prinrt $2}' |cut -c 6- ` After I edit it in the .cshrc file and run "source .cshrc" , I run the "checketh0" command in the terminal , the screen displays the "192.168.7.24: Command not found " Why does is it ?Any
2010 Mar 06
1
Define an alias with an embeded awk command error ?
Hi, guys: I'm trying to define an alias in .cshrc with the embeded awk command, like this : alias checketh0 "ip add ls eth0 |awk '/inet/{print $2}' |sed -n '1p' " Then i run "source ~/.cshrc" and run "checketh0" command in the terminal , but the result is the following : " inet 192.168.18.18/24 brd 192.168.18.255 scope global
2011 Mar 17
1
ssh remote execute awk problem
Hi , all : There is a problem on executing awk command to remote servers; The shell test script is like this : 1. #!/bin/sh 2. 3. _CMD="ssh root at localhost" 4. 5. cpu_num="$($_CMD awk '/processor/{count["proc"]++}; END{print count["proc"]}' /proc/cpuinfo)? 6. 7. echo $cpu_num My root account can entry the server without