Searching Alphanumeric Character From a File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Searching Alphanumeric Character From a File
# 1  
Old 07-18-2012
Bug Searching Alphanumeric Character From a File

Hi,

In a error log file, the error code of a particular error contains both Alphabet and Numbers. My problem statement is to find the error codes from a particular log. That means, I need to search a word, which contains both alphabet and number. Please help me. Below is two examples of error log entry. Error codes are in red color. error code may be different.

Code:
06 Jul 2012 22:45:55,092 [ERROR] SendToClientService [ACTIVE] ExecuteThread: '38' for queue: 'weblogic.kernel.Default (self-tuning)': Detailed Exception occured: JMS attempted to perform an MQPUT or MQPUT1; however WebSphere MQ reported an error.com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2007: Failed to send a message to destination.

16 Jul 2012 11:46:45,650 [ERROR] SendToClientService [ACTIVE] ExecuteThread: '256' for queue: 'weblogic.kernel.Default (self-tuning)': CL1ESB0030S9010 [1] Error while Checking Format.

Thanks in advance.

Moderator's Comments:
Mod Comment Code tags for code, please.

Last edited by Corona688; 07-18-2012 at 03:01 PM..
# 2  
Old 07-18-2012
Code:
awk '{for(N=1; N<=NF; N++) if(($N ~ /[0-9]/) && ($N ~ /[a-zA-Z]/) && !($N ~ /;/)) print $N }'

This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Increment Column having Alphanumeric value in file

I want to replace a column(first and last) having an alphanumeric value in a file. Requirement : 1)All values in a Column must be unique and contain an incremented pattern “HCTV0096” for first column and “cafefeca0090” for last column 2)for uniquely identifying each value in column Numeric part... (6 Replies)
Discussion started by: ketanraut
6 Replies

2. Shell Programming and Scripting

Searching invalid character in list of client name

Hi Friend, I have a client name list and client name has some invalid character due to which some issue raised and list of client are15k. I want to make script who find invalid character name. can you please help me how i can make script, i means i need logic. Valid character are :- ... (5 Replies)
Discussion started by: pallvi_mahajan
5 Replies

3. UNIX for Dummies Questions & Answers

Want to sort a file which contains alphanumeric strings

I want to sort a file which contains alphanumeric string. bash-3.00$ cat abc mtng1so mtng2so mtng11so mtng9so mtng23so mtng7so hstg2so hstg9so hstg1so hstg11so hstg13so bash-3.00$ Want output like this, using one liner. hstg1so (1 Reply)
Discussion started by: Raza Ali
1 Replies

4. UNIX for Dummies Questions & Answers

Exclude new line character while searching

Hi, I have a log file and want to search "0.48976360737438795" with excluding new line character. Currently i am using the following command: cat LogFile.log | tr -d '\n' | grep '0.48976360737438795' This command giving me the response if file size is small but if i am using a big file... (11 Replies)
Discussion started by: ankit jain
11 Replies

5. Shell Programming and Scripting

searching a file with a specified text without using conventional file searching commands

without using conventional file searching commands like find etc, is it possible to locate a file if i just know that the file that i'm searching for contains a particular text like "Hello world" or something? (5 Replies)
Discussion started by: arindamlive
5 Replies

6. Shell Programming and Scripting

Awk: Searching for length of words between slash character

Dear UNIX Community, I have a set of file paths like the one below: \\folder name \ folder1 \ folder2 \ folder3 \ folder4 \\folder name \ very long folder name \ even longer name I would like to find the length of the characters (including space) between the \'s. However, I want... (6 Replies)
Discussion started by: vnayak
6 Replies

7. UNIX for Dummies Questions & Answers

to find alphanumeric character

Hi All, I am having a data file which consists of lakhs of records in the below foramt: "1223323","4341341","discription aadfad" "3123123","5463456","discription aadfad" "2343324","6565767","discription asdfads" "A3423423","7957456","discription aadfad" "343453B","7957456","discription... (1 Reply)
Discussion started by: abhi_123
1 Replies

8. UNIX for Dummies Questions & Answers

Searching a particular character in a file

Hi, I want to search how many times is "a" present in a file named "data". How to do this? Please help (4 Replies)
Discussion started by: gautamshaw
4 Replies

9. Shell Programming and Scripting

Searching a string for a character

I have a co-worker that is trying to make a Wheel of Fortune game and he wants to know if there is a way to search a string for the letter given by the user. (7 Replies)
Discussion started by: turbulence
7 Replies

10. UNIX for Dummies Questions & Answers

searching for $ character

I need to search in text files for the $ character. I tried putting it in double quotes and single quotes . ie grep "$" filename but unix finds everything in the file. Whats the best way to do this? thanks (4 Replies)
Discussion started by: MizzGail
4 Replies
Login or Register to Ask a Question