Questions tagged [nawk]

`nawk` is a pattern scanning and processing language.

A nawk program is a sequence of patterns and corresponding actions.

The string specifying program must be enclosed in single quotes (') to protect it from interpretation by the shell.

The sequence of pattern - action statements can be specified in the command line as program or in one, or more, file(s) specified by the -f progfile option.

When input is read that matches a pattern, the action associated with the pattern is performed.

125 questions
-2
votes
3 answers

An error with asterisk in if statement

I'm having problem with the following code: nawk -F "," '{if($2<=2)&&($9!=45)&&($11==2348*)) print $2}' abc12* | wc -l The error is in ($11==2348*). I tried to put this number in variable x and do ($11==$x*).
-2
votes
2 answers

not getting the latest against the uniq with awk

65 20150427 000000000 8 20120930 000000000 18 20130626 000000000 6 20140505 000000000 1 20150603 000000000 18 20140712 000000000 65 20150502 000000000 10 20150113 000000000 92 20140707 000001000 20 20130530 000000000 11 20141231 000000000 15…
-2
votes
2 answers

How to delete lines & populate based on particluar field in unix

I want to delete lines based on "CLIENT TOTAL" and the succeeding unit lines untill next name. The number of unit lines(i.e lines with 30.0 and 15.0) after "CLIENT TOTAL" line may vary untill the next name. Most importantly the file is not…
-3
votes
1 answer

not able to understand NAWK use

I found a command which takes the input data from a binary file and writes into a output file. nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=1 a=19 s="Ericsson_OCS_V1_0.0.0.7"…
KnowledgeSeeeker
  • 620
  • 1
  • 9
  • 14
-4
votes
1 answer

AWK report formatting

I have a task that needs to output the result of the diags — whether it is pass "P", fail "F", halted "H". As for the cps_ck that is not found in the example input file, it will give me "X" meaning "not executed". Sample…
1 2 3
8
9