UNIX-how to find out the numeric value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX-how to find out the numeric value
# 1  
Old 07-27-2015
UNIX-how to find out the numeric value

Hi All,

I need to found the below numeric value using unix(shell) commands in .txt file and its available in root directory.

for example: file name is siva.txt and content is

Code:
Siva_12345_werwerwe,11,22,33
Siva_12346_werwerwe,22,33,44
Siva_12347_werwerwe,55,44,66

for above string i need only 12345,12346,12347 numeric values only in before first comma(,).
Kindly help me

Thanks
Siva

Last edited by Don Cragun; 07-27-2015 at 07:11 AM.. Reason: Add CODE AND ICODE tags.
# 2  
Old 07-27-2015
Please use code tags as required by forum rules!

How or where are those strings stored? In a file? One or more shell variables?
What's your system (OS, shell)?
# 3  
Old 07-27-2015
Code:
awk -F ',' '{gsub(/[^0-9]/, x, $1); print $1}' siva.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get a numeric value from Oracle to UNIX variable without spaces?

Hi, I am using the below code to get a numeric value from oracle to unix variable: BD_RC_CNT=`sqlplus -s ${WMD_DM_CONNECT} <<EOF set heading off set pagesize 0 Select count(*) from wmd_bad_data where proc_id = ${PROC_ID} and file_id = ${FILE_ID} and file_dt =... (7 Replies)
Discussion started by: Arun Mishra
7 Replies

2. Shell Programming and Scripting

Find the numeric value in a string and then check the max. value

hi, i have a string " 00000069 ThreadMonitor W WSVR0606W: Thread "WebContainer : 43|null" (00000069) was previously rep orted to be hung but has completed. It was active for approximately 47533430 milliseconds. There is/are 43 thread(s) in tot al in the server that still may be hung." ... (4 Replies)
Discussion started by: lovelysethii
4 Replies

3. Shell Programming and Scripting

find numeric duplicates from 300 million lines....

these are numeric ids.. 222932017099186177 222932014385467392 222932017371820032 222932017409556480 I have text file having 300 millions of line as shown above. I want to find duplicates from this file. Please suggest the quicker way.. sort | uniq -d will... (3 Replies)
Discussion started by: pamu
3 Replies

4. Shell Programming and Scripting

Find and delete files and folders which are n days older from one unix server to another unix server

Hi All, Let me know how can i find and delete files from one unix server to another unix server which are 'N' days older. Please note that I need to delete files on remote unix server.So, probably i will need to use sftp, but question is how can i identify files and folders which are 'N'... (2 Replies)
Discussion started by: sachinkl
2 Replies

5. UNIX for Dummies Questions & Answers

Find and Replace random numeric value with non-numeric value

Can someone tell me how to change the first column in a very large 17k line file from a random 10 digit numeric value to a non numeric value. The format of lines in the file is: 1702938475,SNU022,201004 the first 10 numbers always begin with 170 (6 Replies)
Discussion started by: Bahf1s
6 Replies

6. UNIX for Dummies Questions & Answers

UNIX to find the unix mail id

Hi all, Need you assistace. is there any command available in UNIX to find the unix mail id ? tried using 'mail' but no use kindly helpe me out. Thanks in advance. manas (2 Replies)
Discussion started by: manas6
2 Replies

7. Shell Programming and Scripting

Little bit weired : Find files in UNIX w/o using find or where command

Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same. Thanks in advance. Regards Jatin Jain (10 Replies)
Discussion started by: jatin.jain
10 Replies

8. Shell Programming and Scripting

Perl code to differentiate numeric and non-numeric input

Hi All, Is there any code in Perl which can differentiate between numeric and non-numeric input? (11 Replies)
Discussion started by: Raynon
11 Replies

9. AIX

unix updates- Where can I find unix updates online for IBM servers?

I have a Unix based server running Sagitta and the server is giving me an error of 4b10004 and my research tells me this is an EPROM issue, which means the processor needs to be flashed or repaired. Once up and running where can I go to get updates for Unix? (1 Reply)
Discussion started by: crainer
1 Replies

10. Shell Programming and Scripting

how to find a file in UNIX without find command?

given a start directory,a filename,how to find it? (3 Replies)
Discussion started by: bluo
3 Replies
Login or Register to Ask a Question