Can some body tell me how to print number of line from a particular file, with sed. ?
Input file format
AAAA
BBBB
CCCC
SDFFF
DDDD
DDDD
Command to print line 2 and 3 ?
BBBB
CCCC
And also please tell me how to assign column sum to variable.
I user the following command it... (1 Reply)
Hello there.
I want some help with awk
I have this script that reads a file from awk and you can insert from keyboard any list from the fields that exist so to be printed on monitor
echo "give a choice"
read -a ans
array=${ans}
awk -F: -v k="$array" '{
... (4 Replies)
Hi,
I need help in printing out the dates with the largest value in front of it using awk.
436 28/Feb/2008
436 27/Feb/2008
436 20/Feb/2008
422 13/Feb/2008
420 23/Feb/2008
409 21/Feb/2008
402 26/Feb/2008
381 22/Feb/2008
374 24/Feb/2008
360... (7 Replies)
Hi,
I wrote an awk script to analyse file A.
I call the script with files A and B. File A has lines like:
000000033100001
000000036100001
000000039100001
The first 9 characters are interpreted as a line number;
for each line number found I want to output this line number of file B.
... (13 Replies)
hi guys,
i have the following problem: i have a matrix with 3 columns and over 450 rows like this:
0.0165 0.0151 0.0230
0.0143 0.0153 0.0134
0.0135 0.0123 0.0195
0.0173 0.0153 0.0182
i now want to calculate the average of every line and divide every element of this... (1 Reply)
Is it possible to print max number of 2 columns - awk
note: print max if the integer is positive and print min if the integer is negative
input
a 1 2
b 3 4
c 5 1
d -3 -5
d -5 -3
output
a 2
b 4
c 5
d -5
d -5 (4 Replies)
I would like to print the number of records of 2 files, and divide the two numbers
awk '{print NR}' file1 > output1
awk '{print NR}' file2 > output2
paste output1 output2 > output
awl '{print $1/$2}' output > output_2
is there a faster way? (8 Replies)
Hi
I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field.
The source file is pipe delimited and looks something like
1|net|ABC Letr1|1530|||
1|net|EXP_1040 ABC|1121|||
1|net|EXP_TG1224|1122|||
1|net|R_North|1123|||... (5 Replies)
I have the following awk script that I am using to find the max value in the file and print results.
awk 'BEGIN {MAX=-1E100} {for (x=2; x<=NF; x++) if ($x>MAX) {MAX = $x; C1 = $1}} END {print substr(C1,1,11), substr(C1,13,4), substr(C1,18,2), MAX}' ABC*
Input (ABC*)
... (6 Replies)
Now I'm trying summary sar data.
CPU , Memory , Traffic , TPS (Min Max value)
CPU is okay using below command.
$ sar -p | awk '{gsub(//,"")}1' | awk 'BEGIN {min=1000000; max=0;};\
{ if($7<min && $7 != "") min = $7; if($7>max && $7 != "") max = $7; } END {print min, max}'
98.93 99.55
... (1 Reply)
Discussion started by: tom8254
1 Replies
LEARN ABOUT PHP
cubrid_field_type
CUBRID_FIELD_TYPE(3) 1 CUBRID_FIELD_TYPE(3)cubrid_field_type - Return the type of the column corresponding to the given field offsetSYNOPSIS
string cubrid_field_type (resource $result, int $field_offset)
DESCRIPTION
This function returns the type of the column corresponding to the given field offset. The returned field type could be one of the follow-
ing: "int", "real", "string", etc.
PARAMETERS
o $result
-Array type of the fetched result CUBRID_NUM, CUBRID_ASSOC, CUBRID_BOTH.
o $field_offset
- The numerical field offset. The $field_offset starts at 0. If $field_offset does not exist, an error of level E_WARNING is also
issued.
RETURN VALUES
Type of the column, on success.
FALSE when invalid field_offset value.
-1 if SQL sentence is not SELECT.
EXAMPLES
Example #1
cubrid_field_type(3) example
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$result = cubrid_execute($conn, "SELECT * FROM code");
$col_num = cubrid_num_cols($result);
printf("%-15s %-15s %s
", "Field Table", "Field Name", "Field Type");
for($i = 0; $i < $col_num; $i++) {
printf("%-15s %-15s %s
",
cubrid_field_table($result, $i), cubrid_field_name($result, $i), cubrid_field_type($result, $i));
}
cubrid_disconnect($conn);
?>
The above example will output:
Field Table Field Name Field Type
code s_name char
code f_name varchar
PHP Documentation Group CUBRID_FIELD_TYPE(3)