10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
# more minusf.awk
#!/bin/awk -f
BEGIN {
FS=":";
}
{
if ( $2 == "" ) {
print $1 ": no password!";
}
}
# ./minusf.awk aa aa aa aa
awk: can't open aa (6 Replies)
Discussion started by: sri.phani
6 Replies
2. Shell Programming and Scripting
Hi, i want to print 2nd column value with the below script. I need to take input of the string i need to search in that file and file name. How can i take these two as inputs? using read command? Getting error for below script.
echo "enter SID"
read SID
echo "enter filename"
read filename... (8 Replies)
Discussion started by: sam_bd
8 Replies
3. UNIX for Dummies Questions & Answers
Hi all, I'm looking for an awk solution for taking bins of data set.
For example, if I have two columns of data that I wish to use for a scatter plot, and it contains 5 million lines, how can I take averages of every 100 points, 1000, 10000 etc...
The idea is to take bins of the 5,000,000 points... (7 Replies)
Discussion started by: torchij
7 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have a space delimited text file that looks like the following:
Aa 100 200
Bb 300 100
Cc X 500
Dd 600 X
Basically, I want to take the average of columns 2 and 3 and print it in column 4. However if there is an X in either column 2 or 3, I want to print the non-X value. Therefore... (11 Replies)
Discussion started by: evelibertine
11 Replies
5. UNIX for Dummies Questions & Answers
Hey all, I am relatively poor at programming and unfortunately don't have time to read about programming at this current moment.
I wanted to be able to run a simple command to read a column of numbers in a file and give me the average of those numbers. In addition if I could specify the... (2 Replies)
Discussion started by: Leonidsg
2 Replies
6. Shell Programming and Scripting
typeset -i i=1
while read -r filename; do
Splitfile=`$Targetfile_$i.txt`
awk 'substr($0,1,5) == substr($filename,1,5) && substr($0,526,2) == substr($filename,6,2) && substr($0,750,12) == substr($filename,8,12)' $SourceFilename >> $Splitfile
i=i+1
done < /tmp/list.out
I am using this logic... (1 Reply)
Discussion started by: pukars4u
1 Replies
7. Shell Programming and Scripting
Hi,
I have 20 files which have respective 50 lines with different values.
I would like to process each line of the 50 lines in these 20 files one at a time and do an average of 3rd field ($3) of these 20 files. This will be output to an output file.
Instead of using join to generate whole... (8 Replies)
Discussion started by: ahjiefreak
8 Replies
8. Shell Programming and Scripting
Hi
I am looking for an awk script which can compute average of all the fields every 5th line. The file looks:
A B C D E F G H I J K L M
1 18 13 14 12 14 13 11 12 12 15 15 15
2 17 17 13 13 13 12 12 11 12 14 15 14
3 16 16 12 12 12 11 11 12 11 16 14 13
4 15 15 11 11 11 12 11 12 11... (6 Replies)
Discussion started by: saint2006
6 Replies
9. Shell Programming and Scripting
Hi,
I have the data like this
$1 $2
1 12
2 13
3 14
4 12
5 12
6 12
7 13
8 14
9 12
10 12
i want to compute average of $1 and $2 every 5th line (1-5 and 6-10)
Please help me with awk
Thank you (4 Replies)
Discussion started by: saint2006
4 Replies
10. Shell Programming and Scripting
A few questions: I'm trying to use Bash (although I'm not against using AWK) to try to accomplish a few things, but I'm stumped on a few points.
I'm learning most of the basics quickly: but there are a few things I can't figure out.
1. I'm trying to count the number of .txt files in a... (3 Replies)
Discussion started by: Asylus
3 Replies