9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
gawk 'BEGIN{count=0} /^Jan 5 04:33/,0 && /fail/ && /09x83377/ { count++ } END { print count }' /var/log/syslog
what is wrong with this code? i want to search the strings "fail" and "09x83377" from all entries. im grabbing all entries in the log starting from Jan 5 04:33 to the end of the... (3 Replies)
Discussion started by: SkySmart
3 Replies
2. Shell Programming and Scripting
Example:
$ cat file1
2
3$ cat file2
1
2
3
4
5
6The following awk script works like a charm, NR==FNR is true for file1, the remainder runs for file2:
awk '
NR==FNR {A; next}
($1 in A)
' file1 file2
2
3Now have an empty file1:
>file1and run the awk script again.
The result is empty... (8 Replies)
Discussion started by: MadeInGermany
8 Replies
3. Shell Programming and Scripting
How to write in awk to remove lines starting with "#" and then process the file:
This is not working:
cat file|awk '{if ($0 ~ /^#/) $0="";print NF>0}'
When I just give cat file|awk '{if ($0 ~ /^#/) $0="";print }'
it prints the blank lines . I don't wnat the blank lines along with the... (15 Replies)
Discussion started by: rveri
15 Replies
4. Shell Programming and Scripting
Hi Experts,
I am trying to print $2 & the IP_address upto 3rd octet only.
But unable to do so, Trying # awk '{print $2, substr($4,1,9)}' file . but not correct
File:
HOST= cmiHOST06 :: 10.26.107.73:/data120 /nbu/cmiHOST06/athpx07/aa1
HOST= cmiHOST05 :: 10.26.12.76:/data120... (5 Replies)
Discussion started by: rveri
5 Replies
5. Shell Programming and Scripting
Hi fellow linux-ers,
I have a quick question for you. I have the following text, which I would like to modify:
10 121E(121) 16 Jan
34S 132E 24 Feb
42 176E(176) 18 Sep
21S 164E 25 May
15 171W(-171) 09 Jul
How can I do the following 2 modifications using sed and/or awk?
1. in 1st column,... (1 Reply)
Discussion started by: lucshi09
1 Replies
6. Shell Programming and Scripting
bash-2.05$ A=`cat /etc/group |awk -F':' '{if ($1$3$4 ==... (3 Replies)
Discussion started by: ak835
3 Replies
7. UNIX for Dummies Questions & Answers
Ok, this may be very simple but I can't find a solution. I have a list of numbered values which I have grepped from a larger life.
ex/
1:7.54
2:4.52
3:3.22
4:2.11
5:3.59
6:4.36
7:6.88
8:12.28
9:13.37
10:15.6
11:17.66
12:14.25
I need a quick way to organize them (using awk?)... (4 Replies)
Discussion started by: jdolny
4 Replies
8. Shell Programming and Scripting
Ok. I'm just starting to use AWK and I have a question. Here's what I'm trying to do:
uname -n returns the following on my box:
ftsdt-svsi20.si.sandbox.com
I want to pipe this to an AWK statement and make it only print:
svsi20
I tried:
uname -n | awk '{ FS = "." ; print $1 }'
... (5 Replies)
Discussion started by: Probos
5 Replies
9. UNIX for Dummies Questions & Answers
I've made an awk command that works successfully.
However I'd like to add one character to it.
For example instead of /what_i_have_now/
I'd like to change just ONE field to the opposite with an exclamation point.
Like this: ! /what_i_have_now/
My question, where am I supposed to place... (1 Reply)
Discussion started by: yongho
1 Replies