How to use grep with numerical values?

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to use grep with numerical values?
# 1  
Old 09-07-2013
How to use grep with numerical values?

I'm new to Unix and I have been trying to fix this problem for the past week.

How would I use grep to display only certain numbers for a list. For example, if I have this list:

Joe   senior   4/50 
John  junior   25/50
Mary  junior  41/50
Martha sophomore 2/50

How do I get a file containing just the third column with numbers from 0-9/50? When I use grep '[0-9]' , it gives me 2/50 AND 25/50. I just want the single digit numbers. I have only learned how to use the "grep", "cut", and "sort" commands. Thanks for everyone's help in advance.
# 2  
Old 09-07-2013
grep "[^0-9][0-9]/50"

[^0-9] means a character that is not 0-9
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Gawk: PROCINFO["sorted_in"] does not sort my numerical array values

Hi, PROCINFO seems to be a great function but I don't manage to make it works. input: B,A,C B B,B As an example, just want to count the occurence of each letter across the input and sort them by decreased order. Wanted output: B 4 A 1 C 1 When I use this command, the PROCINFO... (4 Replies)
Discussion started by: beca123456
4 Replies

2. UNIX for Dummies Questions & Answers

Grep multiple values

This for i in /dev/disco/*;do lvdisplay $i|grep -i size;done Return me every size of lvm in vg "disco" I want to return me,the size and the name of lvm,how to do this? Thanks (7 Replies)
Discussion started by: Linusolaradm1
7 Replies

3. Shell Programming and Scripting

Grep values from different lines

Hello, I have a log file with many lines and I want to grep pcific values from spcific lines, I'm not sure if it is possible or not Sample 16-11-11 19:54:13:INFO:Connection to device ip took 0 16-11-11 19:54:13:FINE:Sending request. 16-11-11 19:54:13:INFO:Received response from... (3 Replies)
Discussion started by: roby2411
3 Replies

4. UNIX for Dummies Questions & Answers

Extracting rows from a text file based on numerical values of a column

I have a text file where the second column is a list of numbers going from small to large. I want to extract the rows where the second column is smaller than or equal to 0.0001. My input: rs10082730 9e-08 12 46002702 rs2544081 1e-07 12 46015487 rs1425136 1e-06 7 35396742 rs2712590... (1 Reply)
Discussion started by: evelibertine
1 Replies

5. Shell Programming and Scripting

grep distinct values

this is a little more complex than that. I have a text file and I need to find all the distinct words that appear in a line after the word TABLESPACE when I grep for just the word tablespace, I get: how do i parse this a little better so i have a smaller file to read? This is just an... (4 Replies)
Discussion started by: guessingo
4 Replies

6. Programming

Fuzzy Match Logic for Numerical Values

I have searched the internet (including these forums) and perhaps I'm not using the right wording. What I'm looking for is a function (preferably C) that analyzes the similitude of two numerical or near-numerical values, and returns either a true/false (match/nomatch) or a return code that... (4 Replies)
Discussion started by: marcus121
4 Replies

7. Shell Programming and Scripting

grep two values together.

Hi... I have a file abc.txt , havin more then 10,000 lines, each field separated by '#'. I want to grep 9914699895 and 999 from abc.txt I am trying cat abc.txt | grep 9914699895 | grep 999 but i am also getting data like 9991111111 or 9991010101 I want to grep "999" exactly and... (1 Reply)
Discussion started by: tushar_tus
1 Replies

8. UNIX for Dummies Questions & Answers

Can grep do numerical comparisons?

Say for example I have a list of numbers.. 5 10 13 48 1 could I use grep to show only those numbers that are above 10? For various reasons I can only use grep... not awk or sed etc. (7 Replies)
Discussion started by: Uss_Defiant
7 Replies

9. UNIX for Dummies Questions & Answers

grep using ASCII values

machine: HPUX file: a.dat contents: decimal 1 decimal 2 string 1 string 2 ASCII value of 'd': 100. to grep lines that have 'd', I use the following command grep d a.dat My requirement: I should grep for lines that contain 'd'. But I should use ASCII value of 'd' in the command... (1 Reply)
Discussion started by: sriksama
1 Replies

10. Shell Programming and Scripting

grep a list of values

Hi everybody! :) :D :D :) it's great to be here since this is my first post. touch /base/oracle/FRA/XMUT00/RMAN_FLAG touch /base/oracle/FRA/XRLL00/RMAN_FLAG find directory name containing RMAN_FLAG : $ find /base/oracle/FRA -name RMAN_FLAG -print|xargs -n1 dirname |sort -u... (3 Replies)
Discussion started by: jolan_louve
3 Replies
Login or Register to Ask a Question