10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Probably a simple to this, but unsure how to do it. I would prefer an AWK solution. Below is the data set.
1 2 3
2 5 7
4 6 9
1 5 4
8 5 7
1 1 10
15 3 12
3 7 9
9 8 10
4 5 2
9 1 10
4 7 9
7 12 6
9 13 8
For the second... (11 Replies)
Discussion started by: mollydog11
11 Replies
2. Shell Programming and Scripting
Hi Unix team,
I have a file with 30 columns with tab delimited. I need to count the records based on column 18 & 21 data.
So I cut the data from the file using
awk -F"\t" '{print $18,$21}' foo.txt
Following is the output:
USED SEDAN
USED SUV
NEW SUV
USED Truck
USED Truck
USED... (6 Replies)
Discussion started by: karumudi7
6 Replies
3. Shell Programming and Scripting
ok, so a user can specify options as is shown below:
ExA:
cpu.pl!23!25!-allow
or
ExB:
cpu.pl!23!25!-block!all
options are delimited by the exclamation mark.
now, in example A, there are 4 options provided by the user.
in example B, there are 5 options provided by the user.
... (3 Replies)
Discussion started by: SkySmart
3 Replies
4. Shell Programming and Scripting
HI,
i have a file like this
t.txt
f1|_f2|_
f1|_f2|_
f1|_f2|_
as if col delimiter is |_ and row delimiter |_\n
trying to count number of records using awk
$ awk 'BEGIN{FS="|_" ; RS="~~\n"} {n++}END{print n} ' t.txt
7
wondering how can i count this to 3 ?
thx (9 Replies)
Discussion started by: aksforum
9 Replies
5. Shell Programming and Scripting
Hi,
I want to perform a task using shell script. I am new to awk programming and any help would be greatly appreciated.
I have the following 3 files (for example)
file1:
Name count Symbol
chr1_1_50 10 XXXX
chr3_101_150 30 YYYY
File2:
Name ... (13 Replies)
Discussion started by: Diya123
13 Replies
6. Shell Programming and Scripting
Hi every one;
I have a 31500-line text file upon which two following tasks are to be performed:
1: Rearranging the file
2: Taking the average of each column (considering number of zeros) and output the result into a new file
This is the code I've come up with:
awk '(NR%3150<3150)... (0 Replies)
Discussion started by: nxp
0 Replies
7. Shell Programming and Scripting
Hi,
Please help me in counting the below records(1st field) from samplefile:
Expected output:
Count Descr
-------------------------------------------
7 Mean manager
14 ... (7 Replies)
Discussion started by: prashant43
7 Replies
8. Shell Programming and Scripting
Hi, I am having the following number in the file tmp
31013.004
20675.336
43318.190
30512.926
48992.559
277893.111
41831.330
8749.113
415980.576
28273.054
I want to add these numbers, I am using following script
awk 'END{print s}{s += $1}' tmp
its giving answer 947239 which is correct,... (3 Replies)
Discussion started by: chaitubek
3 Replies
9. Shell Programming and Scripting
I need "awk solution" for simple counting!
File looks like:
STUDENT GRADE
student1 A
student2 A
student3 B
student4 A
student5 B
Desired Output:
GRADE No.of Students
A 3
B 2
Thanks for awking! (4 Replies)
Discussion started by: saint2006
4 Replies
10. Shell Programming and Scripting
I have a flat file and need to count no of records in the file less the header and the trailer record.
I would appreciate any and all asistance
Thanks
Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies