Sponsored Content
Top Forums UNIX for Dummies Questions & Answers need a command to search for numbers greater than 3000 Post 302509186 by Franklin52 on Wednesday 30th of March 2011 08:03:50 AM
Old 03-30-2011
Quote:
Originally Posted by takyeldin
i have a file contains:

Code:
13213,A,300
3423,C,200
5563,A,201
3000,A,400
3000,A,402
3000,A,206
3000,A,303
3000,A,200
4233,N,204

i need to search for numbers in the first column are greater than 3000?

i have another issue if you can help me?
if i want to search in the second or the third columns what is the command that i can use to specify a specific column to search in .....
For the 1st column:
Code:
awk -F, '$1 > 3000' file

Adjust the column number for other columns, $2 for the 2nd column, $3 for the 3th column and so on.
This User Gave Thanks to Franklin52 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to remove line greater then 3000 characters.

I am using awk and it stops when it encounter line greater then 3000 character. Is there any command which will help me remove line greater then 3000 characters. (10 Replies)
Discussion started by: naren_14
10 Replies

2. Shell Programming and Scripting

How to perform calculations using numbers greater than 2150000000.

Could someone tell me how to perform calculations using numbers greater than 2150000000 in Korn Shell? When I tried to do it it gave me the wrong answer. e.g. I have a ksh file with the contents below: --------------------------------- #!/bin/ksh SUM=`expr 2150000000 + 2` PRODUCT=`expr... (3 Replies)
Discussion started by: stevefox
3 Replies

3. Shell Programming and Scripting

replacing numbers greater than 0 with 1

I have some ASCII files containing numerous numbers. What I'd like to do is replace all numbers greater than 0 with 1. Examples of the numbers include: - 000011 and 000042 Thanks (4 Replies)
Discussion started by: vrms
4 Replies

4. Homework & Coursework Questions

Problem with awk,not able print the file that is greater than 3000 bytes.

My Script: #!/bin/sh date=`date +%y%m%d -d"1 day ago"` in_dir=/vis/logfiles/to_solmis cp `grep -il ST~856~ $inbound_dir/*$date*` /vis/sumit/in_ASN/ for i in /vis/sumit/in_ASN/* do mkdir -p /vis/sumit/inboundasns.$date cp `echo $i`... (1 Reply)
Discussion started by: shrima.pratima
1 Replies

5. Shell Programming and Scripting

search column and delete row if greater than value

Hi, as the title states i need to find a way to search a column for values great than 1000, and if it is, then delete that row. An example 1 7.021 6.967 116.019 4 U 6.980E+07 0.000E+00 e 0 0 0 0 2 8.292 7.908 118.063 3 U 1.440E+07 0.000E+00 e 0 821 814 ... (3 Replies)
Discussion started by: olifu02
3 Replies

6. Shell Programming and Scripting

search file for value greater than 'n' on each line and email

Hi, I need to write a script that will read each line of a CSV file, look for values greater than x seconds and email an alert. For the first part, I have one CSV per day, each line in the CSV has comma separated values. There are a total of 8 fields per line separated by commas. 6th and 7th... (3 Replies)
Discussion started by: ssid
3 Replies

7. Shell Programming and Scripting

How to search for numbers greater than x?

I have a file with multiple fields, example below File 1: Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|100 Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|101 Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|102 Field 1|Field 2|Field 3|Field 4|Field 5|Field... (4 Replies)
Discussion started by: castrojc
4 Replies

8. UNIX for Dummies Questions & Answers

Grep lines with numbers greater than 2 digits at the end of the line

I'm trying to grep lines where the digits at the end of each line are greater than digits. Tried this but it will only allow me to specify 2 digits. Any ideas would greatly be appreciated. grep -i '\<\{3,4,5\}\>' file ---------- Post updated at 05:58 PM ---------- Previous update was at 05:41... (1 Reply)
Discussion started by: jimmyf
1 Replies

9. UNIX for Beginners Questions & Answers

Find command size greater than or equalto

How do I find the files greater than or equal to a given size using find command. find ./ -size +0k --> Lists files greater than 0K find ./ -size 0k --> Lists the file size equal to 0K. I have other conditions to check, hence using find command. Thanks in advance. (4 Replies)
Discussion started by: deepakwins
4 Replies

10. UNIX for Advanced & Expert Users

Search for columns with numbers greater than 70

This helped get me started. https://www.unix.com/unix-for-dummies-questions-and-answers/157026-need-command-search-numbers-greater-than-3000-a.html This is the command I am using. I am trying to find numbers greater than 70 in column 5. I do not know if it is getting confused because there... (6 Replies)
Discussion started by: cokedude
6 Replies
MAXDB_FETCH_LENGTHS(3)							 1						    MAXDB_FETCH_LENGTHS(3)

maxdb_fetch_lengths - Returns the lengths of the columns of the current row in the result set

       Procedural style

SYNOPSIS
array maxdb_fetch_lengths (resource $result) DESCRIPTION
Object oriented style array$maxdb_result->lengths () The maxdb_fetch_lengths(3) function returns an array containing the lengths of every column of the current row within the result set rep- resented by the $result parameter. If successful, a numerically indexed array representing the lengths of each column is returned or FALSE on failure. RETURN VALUES
An array of integers representing the size of each column (not including any terminating null characters). FALSE if an error occurred. maxdb_fetch_lengths(3) is valid only for the current row of the result set. It returns FALSE if you call it before calling maxdb_fetch_row/array/resource or after retrieving all rows in the result. EXAMPLES
Example #1 Object oriented style <?php $maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $query = "SELECT * from hotel.customer WHERE cno = 3000"; if ($result = $maxdb->query($query)) { $row = $result->fetch_row(); /* display column lengths */ foreach ($result->lengths as $i => $val) { printf("Field %2d has Length %2d ", $i+1, $val); } $result->close(); } /* close connection */ $maxdb->close(); ?> Example #2 Procedural style <?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $query = "SELECT * from hotel.customer WHERE cno = 3000"; if ($result = maxdb_query($link, $query)) { $row = maxdb_fetch_row($result); /* display column lengths */ foreach (maxdb_fetch_lengths($result) as $i => $val) { printf("Field %2d has Length %2d ", $i+1, $val); } maxdb_free_result($result); } /* close connection */ maxdb_close($link); ?> The above example will output something similar to: Field 1 has Length 4 Field 2 has Length 3 Field 3 has Length 5 Field 4 has Length 6 Field 5 has Length 5 Field 6 has Length 21 PHP Documentation Group MAXDB_FETCH_LENGTHS(3)
All times are GMT -4. The time now is 03:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy