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
0
votes
1 answer

Trying to get first letter from first name in nawk script to html

Why is line 17 not working (commented in code)?: #!/bin/nawk -f BEGIN { print "" print "" print " " print " " print " " print " " …
J.S. Orris
  • 4,653
  • 12
  • 49
  • 89
0
votes
1 answer

Nawk script that appends text to html

So, I have been working on my own on something for a week now and am getting nowhere. I am taking a very advance CIS class that I have done well in so far but towards the end I am working with stuff that I haven't learned yet. I should have waited…
J.S. Orris
  • 4,653
  • 12
  • 49
  • 89
0
votes
1 answer

read each line of file using awk and store into an array

i am working on ksh in Sun Solaris. i have a file having only one word as job names per line. want to read all the jobs from the file and execute them one by one in the given orde. how to do it in ksh. the below code works fine if fired on the…
atul
  • 1
  • 1
0
votes
1 answer

How to find and replace a diaeresis?

I have a file containing some diaeresis marks, ̈. I need to replace them with \textdiaeresis, for use in TeX. The usual commands which seem to work with other symbols always causes the output to be \\textdiaeresis or \ extdiaeresis, the later,…
Village
  • 22,513
  • 46
  • 122
  • 163
0
votes
3 answers

Redirect to all files in the directory

Using awk, how can i redirect the data to all files in the directory? like ,lets say i want to redirect to file.txt i will do: echo "abc"|awk '{print >"file.txt"}' how can i acheive the same thing but to multiple files(in fact all files) in the…
Vijay
  • 65,327
  • 90
  • 227
  • 319
0
votes
3 answers

awk command to separate records and save as csv

hi i actually tried to manage an awk script that fiddles with the a text file that has contents like follows . [135]Edwards Engineering Pty Ltd Quality Structural Steel. Specialising In Fabrication And Steel Stairs 21- 23…
Kiran Vemuri
  • 2,762
  • 2
  • 24
  • 40
-1
votes
1 answer

UNIX AWK escaping single quotes

Possible Duplicate: UNIX shell script and escaping quotes for AWK script I have a UNIX script that has nawk block inside it (This is just a part of the UNIX and NAWK script. It has many more logic and the below code should definitely be in…
user549432
  • 137
  • 2
  • 8
  • 20
-1
votes
2 answers

UNIX - Compare 2 files based on primary column

I need to compare 2 files columnwise based on primary columns(it could be 1 or multiple columns as a primate key). And it should generate 3 csv files as output - differences , extra records in file1, extra records in file2 Note : tried with sdiff…
Aru
  • 1
  • 2
-1
votes
2 answers

awk condition for 30th column of a line is not working

My Input file looks like…
ramki_ramakrishnan
  • 169
  • 1
  • 1
  • 9
-1
votes
1 answer

awk find string and under line print

I have data that looks like this: test AA=bddddbs result=1 cell AA=bnnndb5 result=2 cell1 BB=bnrrndb result=3 Please help. Find AA=string. test AA=bddddbs;result=1 cell AA=bnnndb5;result=2 I am use below command and result fail. nawk…
-1
votes
1 answer

trying to get the results using awk

I've a file named xyz.csv which are comma separated.I'm trying to get the output where the 2nd column should have value "01", 50th column as "ABC" and the content of 80th column using nawk?
User123
  • 1,498
  • 2
  • 12
  • 26
-1
votes
2 answers

Understanding A Particular Line of Nawk Command

I am going through shell scripting online lessons as my work requires me to learn shell scripting. I came across "awk" and "nawk " commands and my learning hasn't yet reached up to it. In a nutshell, I know that awk/nawk search for a particular…
itp dusra
  • 153
  • 1
  • 5
-1
votes
1 answer

Executing an awk script from a shell script produces syntax errors

currently I am having a script in which I am calling AWK like /usr/bin/nawk -f rst.awk file1 file2 and rst.awk looks like cat rst.awk { split($2,a,/\./); curr = a[1]*10000 + a[2]*100 + a[3] } NR==FNR { prev[$1] = curr; next } ($1 in prev) && (curr…
rKSH
  • 39
  • 9
-1
votes
1 answer

How do I generate more descriptive filenames for an XML file I'm splitting into pieces?

I have a pair of large/long XML files that I'm using nawk to break apart, so that I can work more easily with the pieces that are actually relevant to my project. The code I have is doing what I want, but it's producing files that lack descriptive…
Seascape
  • 31
  • 7
-1
votes
3 answers

change the date of month in number format in awk

File 1 P1,06/Jul/2013,09/Jul/2013 P2,06/Jul/2013,10/Jul/2013 P3,06/Jul/2013,15/Jul/2013 Ouput i want like this: P1,06/07/2013,09/07/2013,3days P2,06/07/2013,10/07/2013,4days P3,06/07/2013,15/07/2013,9days some one help is need for this please
k3090
  • 25
  • 1
  • 5
1 2 3
8
9
NameUsername