Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Grep lines with numbers greater than 2 digits at the end of the line Post 302770207 by jimmyf on Thursday 14th of February 2013 05:58:35 PM
Old 02-14-2013
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.
Code:
 grep -i '\<[0-9]\{3,4,5\}\>' file

---------- Post updated at 05:58 PM ---------- Previous update was at 05:41 PM ----------

OK, I got it, this works
Code:
grep '[0-9]..'$

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep a line with between 3 and 5 digits

Hi, I am having problems using grep to extract only 3,4 or 5 digit numbers from a text file, using: grep '\<\{3,5\}\>' test.txt or grep '\{3,5\}' test.txt or egrep '{3,5}' test.txt I would appreciate any help that anyone can give me thanks (1 Reply)
Discussion started by: ceemh3
1 Replies

2. Solaris

Need help capturing end of line numbers

Hello All, Currently I am attempting to write a script which will capture a number at the end of a line. The line which I am searching through ends as follows: word word=number for example word word=3 OR word word=15 I am stuck on how to capture whatever is to the right... (3 Replies)
Discussion started by: icalderus
3 Replies

3. UNIX for Advanced & Expert Users

Add line numbers to end of each line

Hi i would like to add line numbers to end of each line in a file. I am able to do it in the front of each line using sed, but not able to add at the end of the file. Can anyone suggest The following code adds line number to start of each line sed = filename | sed 'N;s/\n/\t/' how can i... (5 Replies)
Discussion started by: rudoraj
5 Replies

4. UNIX Desktop Questions & Answers

matching 3 digits at the begining and the end of the line

I have a file with hundreds of records and I need to find those records that have three digits at the beginning and the same three digits at the end. $GREP '\(\)\(\)\(\)\3\2\1'I believe this is part of the script but I am not sure how to compare these 3 digits with the 3 digits at the end of... (2 Replies)
Discussion started by: bartsimpsong
2 Replies

5. Shell Programming and Scripting

Adding patterns with increasing numbers at the end of every line

Hi All, I have a file which has some Linux commands in every line like more 456.dat more 3232.dat more 433.dat I want to add texts like this at the end of every line: more 456.dat > 1.txt more 3232.dat > 2.txt more 433.dat > 3.txt So, that the result of more goes into 1.txt... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

6. Programming

concatinate all lines from second line to end of line in perl

I have datafile like ~dta.yunm shhshsgggssssjsksjs sggsjshsjsjssss shshshhshshshs i wish to take only first line and all other lines in concatenated form in second line what should I do??? output like ~dta.yunm shhshsgggssssjsksjssggsjshsjsjssssshshshhshshshs please tell me how... (7 Replies)
Discussion started by: sujit_singh
7 Replies

7. UNIX for Dummies Questions & Answers

grep quoted numbers from lines

I want to parse the lines and want to extract the double quoted numbers as: "SQL3149N "72" rows were processed from the input file. "0" rows were successfully inserted into the table. "0" rows were rejected." and want the output in 3 variables like a=72 b=0 c=0 thanks in advance ... (3 Replies)
Discussion started by: mahesh_191
3 Replies

8. Shell Programming and Scripting

Grep username and get all the lines with thread numbers

I need help to extract the file. If I am entering the user name like abcd@xyz.com, search the username and get the tread number. Once will get thread number all the line having same threadnumber wanted to keep in seperate file. It can be more than thread number for single username. For... (3 Replies)
Discussion started by: nes
3 Replies

9. UNIX for Advanced & Expert Users

Grep for a line containing only 5 numbers

How would you grep for a line containing only 5 numbers? Something like this. 10 2 12 1 13 (4 Replies)
Discussion started by: cokedude
4 Replies

10. Shell Programming and Scripting

Put in one line only the lines with digits

Hello, I haven't been here for a while and I might be forgetting some things. I have an input text like this titleA http://myurl/bla/blabla/1234 http://myurl/bla/blabla/6789 titleB http://myurl/bla/blabla/5678 http://myurl/bla/blabla/1234 titleC http://myurl/bla/blabla/9123... (10 Replies)
Discussion started by: Kibou
10 Replies
CTYPE_XDIGIT(3) 							 1							   CTYPE_XDIGIT(3)

ctype_xdigit - Check for character(s) representing a hexadecimal digit

SYNOPSIS
bool ctype_xdigit (string $text) DESCRIPTION
Checks if all of the characters in the provided string, $text, are hexadecimal 'digits'. PARAMETERS
o $text - The tested string. RETURN VALUES
Returns TRUE if every character in $text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise. EXAMPLES
Example #1 A ctype_xdigit(3) example <?php $strings = array('AB10BC99', 'AR1012', 'ab12bc99'); foreach ($strings as $testcase) { if (ctype_xdigit($testcase)) { echo "The string $testcase consists of all hexadecimal digits. "; } else { echo "The string $testcase does not consist of all hexadecimal digits. "; } } ?> The above example will output: The string AB10BC99 consists of all hexadecimal digits. The string AR1012 does not consist of all hexadecimal digits. The string ab12bc99 consists of all hexadecimal digits. NOTES
Note If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative val- ues have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string contain- ing the decimal digits of the integer. SEE ALSO
ctype_digit(3). PHP Documentation Group CTYPE_XDIGIT(3)
All times are GMT -4. The time now is 12:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy