Sponsored Content
Top Forums Shell Programming and Scripting how to grep only particular length of numeric values Post 302413660 by somi2yoga on Friday 16th of April 2010 02:11:31 PM
Old 04-16-2010
how to grep only particular length of numeric values

hi

i have two types of file
1. temp.0000000001.data (10 digit numeric)
2. temp.000000001.data (9 digit numeric)

i want to search a file which is having 10 digit numeric in between the file name.

i use command like this..
ls | grep temp.^[0-9]*.data

but this will give both the files as output. now whats the command to get only temp.0000000001.data as output which has 10 digit number in it.

i have one solution with me... its
ls | grep temp.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].data

but please let me know the smart way or the flexible way of doing this...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace spaces with 0's having numeric values.

What could be the regular expression with gsub function in awk to replace all numerics having spaces before to be replaced with 0s? (1 Reply)
Discussion started by: videsh77
1 Replies

2. Shell Programming and Scripting

numeric string and length

given a string passed to a program that supposed to be numeric and of a certain length say 8 digits - so say for e.g. need to verify this 01234567 How would I parse this string to validat it meet requirements I tried to use * | sed /\(\{8})/ Thanks in advance (1 Reply)
Discussion started by: dragrid
1 Replies

3. Shell Programming and Scripting

Replace variable length numeric string

I have a customer who logged some cc and bank account numbers in their apache logs. I got the cc numbers x'd out with sed -e 's/args=\{16\}/args=XXXXXXXXXXXXXXXX/g' -e 's/cardnum=\{16\}/cardnum=XXXXXXXXXXXXXXXX/g'but that wasn't too difficult due to the value being 16 digits. The bank account... (7 Replies)
Discussion started by: mk4mzid
7 Replies

4. Shell Programming and Scripting

stripping out non-numeric values in a list

hi all, i'm very new to scripting and have the folllowing issue. I have used a few commands to get a list of numbers, but I need to strip away the non-numeric ones, and then need a total of all values. any ideas? root@unixserver # cat myfile | awk '{print $8}'| sort -rn 1504 1344 896 704... (2 Replies)
Discussion started by: badoshi
2 Replies

5. Shell Programming and Scripting

Remove non numeric values from a variable

Hello all, I am working on a basic script but need a little help. Issue: I am running a SQL Query using sqlplus and a shell script. I have the output of the statement stored as variable $A. $A is set to "other text here 45678754 other text here". I need to strip all text except that numeric... (13 Replies)
Discussion started by: ownedthawte
13 Replies

6. Programming

numeric values ending in 'U'

I am getting back on the C++ programming after many years away. I recently received an SDK that has code like this where numeric values end in 'U'. What does this mean? if ((ptr % 16U) == 0U) return buffer; (3 Replies)
Discussion started by: sneakyimp
3 Replies

7. Shell Programming and Scripting

How to check if the file contains only numeric values

How to check if the file contains only numeric values. I don't want to read entire file it eats lot of cpu Or any way which consumes less memory n cpu.. Please suggest -S (2 Replies)
Discussion started by: sunilmenhdiratt
2 Replies

8. Shell Programming and Scripting

Assigning numeric values to variable

I have a code like this v_num=9 comp_num=39 if then echo "pass" fi echo "end" I am getting an error ksh: v_num=99 comp_num=39 if then echo "pass" fi echo "end" (3 Replies)
Discussion started by: swayam123
3 Replies

9. UNIX for Dummies Questions & Answers

Count on grep for more than two values in a row of fixed length file

I want to get count on number of records in a few folders by running grep command for more than two columns in a row of fixed length file. suppose if i have a fixed length file has 5 columns and I want to see the record counts for country =can and province = bc and time stamp <= 12 feb 2013... (14 Replies)
Discussion started by: princetd001
14 Replies

10. UNIX for Advanced & Expert Users

Sort by second column numeric values

From googling and reading man pages I figured out this sorts the first column by numeric values. sort -g -k 1,1 Why does the -n option not work? The man pages were a bit confusing. And what if I want to sort the second column numerically? I haven't been able to figure that out. The file... (7 Replies)
Discussion started by: cokedude
7 Replies
fmin(3M)						  Mathematical Library Functions						  fmin(3M)

NAME
fmin, fminf, fminl - determine minimum numeric value of two floating-point numbers SYNOPSIS
cc [ flag... ] file... -lm [ library... ] #include <math.h> double fmin(double x, double y); float fminf(float float x, float y); long double fminl(long double x, long double y); DESCRIPTION
These functions determine the minimum numeric value of their arguments. NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, these functions choose the numeric value. RETURN VALUES
Upon successful completion, these functions return the minimum numeric value of their arguments. If just one argument is a NaN, the other argument is returned. If x and y are NaN, a NaN is returned. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
fdim(3M), fmax(3M), math.h(3HEAD), attributes(5), standards(5) SunOS 5.10 1 Sep 2002 fmin(3M)
All times are GMT -4. The time now is 08:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy