In the second awk, you are assigning the outcome of /Jan/ (1 if true, 0 if false) to field 1.., in the first one, you are comparing 0 or 1 to the value of field 1..
What you are probably looking for is:
or
This User Gave Thanks to Scrutinizer For This Post:
Hi all,
I'm new to awk and I'm experiencing syntax error that I don't know how to resolve. Hopefully some experts in this forum can help me out.
I created an awk file that look like this:
$ cat myawk.awk
BEGIN {
VAR1=PATTERN1
VAR2=PATTERN2
}
/VAR1/ { flag=1 }
/VAR2/ { flag=0 }
{... (7 Replies)
Hi,
I have a log file which contains lines like below:
2010-07-19 07:13:19,021 ERROR system ...(text)
2010-07-19 07:22:03,427 ERROR system ...(text)
class com... (text)
2010-07-19 07:23:19,026 ERROR system ...(text)
class com... (text)
each line is a separate line... I am given the a... (14 Replies)
i guys, i have a bash script , and it works, but i need an awk file, and i can't convert this code like:
#!/bin/awk -f
.....
my script
#!/bin/bash
awk '/\<FIRST\>|\<SECOND\>|\<THIRD\>|\<ZERO\>/' DOC.txt
thanks :) (4 Replies)
Hi,
I want to search for a particular string using awk and print "Found" or "Not Found" depending on the search.
On searching this forum i got this code but it is not working: (6 Replies)
Hello
I am trying to do global search on access log files for a date and for either 'Error|error' string
ls -lrt *access* | grep "Sep 23" | awk '{print $9}'|xargs awk '/23\/Sep\/2011/ && /Error/ || /error'
Above matches All lines with 'error' as well unfortunately.
Is there a... (6 Replies)
I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios.
Cat test
Nov 10, 2012 5:17:53 AM
INFO: Request Type
Line 1.... (5 Replies)
I have a file which requires modification via a shell script.
Need to do the following: 0. take input from user for new text. 1. search for a keyword in the file. 2. going forward, search for another keyword. 3. Replace this line with user supplied input.
for e.g., my file has the following... (6 Replies)
Hi- I have issue with the code to get the input file reformat
--Goal is reformat and print out only column name one per line, leading space or trailing space will be removed...
--TABLE1.DDL as input file, and content of file as show below
REPLACE VIEW TABLE1
(
ID
,COL1
... (3 Replies)
Input:
|Running the Rsync|Sun Oct 16 22:48:01 BST 2016
|End of the Rsync|Sun Oct 16 22:49:54 BST 2016
|Running the Rsync|Sun Oct 16 22:54:01 BST 2016
|End of the Rsync|Sun Oct 16 22:55:45 BST 2016
|Running the Rsync|Sun Oct 16 23:00:02 BST 2016
|End of the Rsync|Sun Oct 16 23:01:44 BST 2016... (4 Replies)
I have this fileA
TEST FILE ABC
this file contains ABC;
TEST FILE DGHT this file contains DGHT;
TEST FILE 123
this file contains ABC,
this file contains DEF,
this file contains XYZ,
this file contains KLM
;
I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)