Hi,
I've a question on awk. In English I want to:
(a) open a file, (b) search through the file for records where length of field15 > 20 characters and (c) print out some fields in the record.
I've written the following and it works OK. The trouble is this will ALWAYS write out the column... (5 Replies)
I'd like to define an alias to awk's begin statement since I use awk with different delimiters all the time and it is tiresome to type awk '{OFS="\t";FS="\t"}{BLAH BLAH}' every time. The problem is that bash won't let me make an alias with an open quote, which is necessary for the BEGIN alias to... (3 Replies)
I am beginner in awk
awk 'BEGIN{for(i=1;(getline<"opnoise")>0;i++) arr=$1}{print arr}'
In the above script, opnoise is a file, I am reading it into an array and then printing the value corresponding to index 20. Well this is not my real objective, but I have posted this example to describe... (1 Reply)
Here's the command I'm running:
# echo "hi" | awk '{etime = system("hostname") ; close("hostname") ; print etime""}'
And here's the ouput:
server.domain.tld
0
Why in the world is that second line, the one that's just "0", there? Many thanks in advance. (2 Replies)
I'm new to awk, trying to understand the basics.
I'm trying to reset the counter everytime the program gets a new file to check.
I figured in the BEGIN part it would work, but it doesn't.
#!/bin/awk -f
BEGIN {counter=0}
{
sum=0
for ( i=1; i<=NF;... (1 Reply)
Hi,
I have written below script to begin if the line has n
#!/bin/ksh
/usr/xpg4/bin/awk {/ n / 'BEGIN {X = "01"; X = "02"; X = "03"; X = "04";
X = "05"; X = "06"; X = "07"; X = "08";
X ="09"; X = "10"; X = "11"; X = "12"; };}
NR > 1 {print $1 "\t" $5 "," X "," $6 " " $7}'} input.txt |... (9 Replies)
Hello,
I need a little help with the following:
I'm using AWK to read input from a comma-seperated value file, and only printing certain fields like so:
awk -F "," '{print $1,$3,$6}' /list.csv | tail -1
Which outputs the following:
server1 APPID OS
I run into a problem... (8 Replies)