Sponsored Content
Top Forums Shell Programming and Scripting Identifying the column number Post 302138039 by ghostdog74 on Friday 28th of September 2007 10:21:56 AM
Old 09-28-2007
go through the fields.
Code:
sar -r | grep 'kbswpcad' | awk '{ for(i;i<=NF;i++){
    if ($i ~ /swpused/) { print i } }
}'

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

identifying duplicates line & reporting their line number

I need to find to find duplicate lines in a document and then print the line numbers of the duplicates The files contain multiple lines with about 100 numbers on each line I need something that will output the line numbers where duplicates were found ie 1=5=7, 2=34=76 Any suggestions would be... (5 Replies)
Discussion started by: stresslog
5 Replies

2. Shell Programming and Scripting

returning a column number

Hi all, i was doing a small program where if i was to be given the first 3 letters of any month i.e. in the form of Jan or Apr then it would return the column number where it finds a match. To do this i created a 12 element array of months with first 3 letters and if i echo'ed the contents of... (2 Replies)
Discussion started by: scriptingmani
2 Replies

3. Shell Programming and Scripting

column number, awk, help

All, $ cat myf.txt A|xyz|1000|mm B|9000|xyz|ss C|BDE|2000|kk D|xyz|1000|nn I am searching "xyz" $ awk -F "|" ' {for(k=0;k<=NF;k++) if ( $k == "xyz" ) print "line="NR"(column="k")" }' myf.txt Output: line=1(column=2) line=2(column=3) line=4(column=2) (2 Replies)
Discussion started by: jkl_jkl
2 Replies

4. UNIX for Dummies Questions & Answers

Dividing a column by it's first number

Hi! Is there an easy way (maybe using awk??) to divide the values of one column of the file by it's first entry.. If I have a column: 3 4 5 6 7 I would like to divide it by 3. I want to do this for more than 100 files, so it wouldn't be practical to open file by file and... (26 Replies)
Discussion started by: cosmologist
26 Replies

5. Shell Programming and Scripting

Summing a number column

hi All, i have a file in which only one column is there., test.txt ====== -900.01 -900.02 -900.03 -900.04 -900.05 -900.06 -900.07 -900.08 -900.09 900.01 900.02 900.03 900.04 900.05 (4 Replies)
Discussion started by: mechvijays
4 Replies

6. Shell Programming and Scripting

Help with compare two column and print out column with smallest number

Input file : 5 20 500 2 20 41 41 0 23 1 Desired output : 5 2 20 0 1 By comparing column 1 and 2 in each line, I hope can print out the column with smallest number. I did try the following code, but it don't look good :( (2 Replies)
Discussion started by: perl_beginner
2 Replies

7. Programming

Unique Number Identifying

I'm trying to solve the below problem for a number: Enter a number and if it has all unique digits print unique number else non-unique number. Eg: Input=123; Output=unique number Input=112; Output=Non-unique number The thing i tried is splitting the number into digits by using % operator... (2 Replies)
Discussion started by: Gautham
2 Replies

8. Shell Programming and Scripting

Split column data if the table has n number of column's

please write a shell script Table -------------------------- 1 2 3 a b c 3 4 5 c d e 7 8 9 f g h Output should be like this --------------- 1 2 3 3 4 5 7 8 9 a b c c d e f g h (1 Reply)
Discussion started by: Priti2277
1 Replies

9. Shell Programming and Scripting

Split column data if the table has n number of column's with some record

Split column data if the table has n number of column's with some record then how to split n number of colmn's line by line with records Table --------- Col1 col2 col3 col4 ....................col20 1 2 3 4 .................... 20 a b c d .................... v ... (11 Replies)
Discussion started by: Priti2277
11 Replies

10. Shell Programming and Scripting

Extract number from column

I have a lot of file with a lot of lines following the same pattern the lines go like this: alpha_9/output- -413.74928476 2.6116 and I want it to be: 9 -413.74928476 2.6116 thanks for the help (5 Replies)
Discussion started by: galboski
5 Replies
DB2_FIELD_NAME(3)							 1							 DB2_FIELD_NAME(3)

db2_field_name - Returns the name of the column in the result set

SYNOPSIS
string db2_field_name (resource $stmt, mixed $column) DESCRIPTION
Returns the name of the specified column in the result set. PARAMETERS
o $stmt - Specifies a statement resource containing a result set. o $column - Specifies the column in the result set. This can either be an integer representing the 0-indexed position of the column, or a string containing the name of the column. RETURN VALUES
Returns a string containing the name of the specified column. If the specified column does not exist in the result set, db2_field_name(3) returns FALSE. SEE ALSO
db2_field_display_size(3), db2_field_num(3), db2_field_precision(3), db2_field_scale(3), db2_field_type(3), db2_field_width(3). PHP Documentation Group DB2_FIELD_NAME(3)
All times are GMT -4. The time now is 10:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy