07-23-2008
grep numbers
Hello,
I'm trying to grep for digits surrounded by non digits and I'm obviously misinformed. Could someone help me get this sorted out
here is what I have that is not working
grep -ho '\D([0-9]\{11\})\D' *.txt
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to grep a range of numbers in a log file. My log file looks like this:
20050807070609Z;blah blah
That is a combination of yr,month,date,hours,minutes,seconds.
I want to search in the log file events that happened between a particular time.
like between 20050807070000 to 20050822070000... (1 Reply)
Discussion started by: azmathshaikh
1 Replies
2. Shell Programming and Scripting
Hi,
I want to find out whether a string contains non numbers and + and -
example :
Str="0005000A" - It contains A
Str="0005000+" - No problem
What I have done is ,
echo $Str | grep
I will have to list out all non numeric characters... (6 Replies)
Discussion started by: shihabvk
6 Replies
3. UNIX for Dummies Questions & Answers
Hi im new to unix and need to find a way to grep the top 5 numbers in a file and put them into another file. For example my file looks like this
abcdef 50000
abcdef 45000
abcdef 40000
abcdef 35000
abcdef 30000
abcdef 25000
abcdef 20000
abcdef 15000
abcdef 10000
and so on...
How can... (1 Reply)
Discussion started by: ProgChick2oo9
1 Replies
4. UNIX Desktop Questions & Answers
Hi all,
I am new to unix and struggling to do the below
I have few lines in a xml
<title>abc:1</title>
<description>abc:2</description>
<language>abc:3</language>
Is it possible to extract only the entire word like abc:1 abc:2 abc:3 instead of the entire line into a new file . Kindly... (3 Replies)
Discussion started by: umapearl
3 Replies
5. Shell Programming and Scripting
I have a txt file with more than 10000 lines. There is a unique pattern which is scattered into the file. it starts with @9 and it has 15 characters. i need to grep them and display along with line numbers.
Eg: File - Test1
test message....
....
..
..
@9qwerty89
...test message... (8 Replies)
Discussion started by: abinash
8 Replies
6. UNIX for Dummies Questions & Answers
I know if i use grep -n that the output will have the lines numbered but is there a way to grep the actually line number.
so like this
grep -n "one" /usr/dict/numbers
1:one
21:twenty-one
31:thirty-one
41:forty-one
51:fifty-one
61:sixty-one
71:seventy-one
81:eighty-one
91:ninety-one
... (1 Reply)
Discussion started by: alindner
1 Replies
7. Shell Programming and Scripting
Dear Friends,
I want to know how to grep for the lines that has a number between given range(start and end).
I have tried the following sed command.
sed -n -e '/20030101011442/,/20030101035519/p'
However this requires both start and end to be part of the content being grepped. However... (4 Replies)
Discussion started by: tamil.pamaran
4 Replies
8. UNIX for Dummies Questions & Answers
I am trying to extract specific information from a large *.sam file (it's originally 28Gb).
I want to extract all lines that are on chr3 somewhere in the range of 112,937,439-113,437,438.
Here is a sample line from my file so you can get a feel for what each line looks like:
seq.4 0 ... (8 Replies)
Discussion started by: genGirl23
8 Replies
9. UNIX for Advanced & Expert Users
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
I have a list of files like below, Do we have grep command to find files?
If i grep 03874 it should display the file 3874, Grep command should ignore 0 at the beginning. There could be more many leading 0's in filename.
$ ls -ltr
total 5
-rw-r--r-- 1 mqm mqm 15 Feb 19 17:07 4769... (3 Replies)
Discussion started by: prince1987
3 Replies