awk command to find particular pattern in file.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk command to find particular pattern in file.
# 1  
Old 07-02-2010
awk command to find particular pattern in file.

Hi
I am using the following command to look for anything other than
"0000" in a comma seperated file on 11th field.
Note: I am looking for "0000" including the double quotes.

Code:
nawk -F"," '$11!='"0000"'{print $11}' file

This is showing incorrect result.
Help is appreciated
# 2  
Old 07-02-2010
Code:
nawk -F"," '$11!="\"0000\""{print $11}' file


Last edited by bartus11; 07-02-2010 at 05:45 PM..
# 3  
Old 07-02-2010
Code:
nawk -F"," -v qt='"' ' $11 != qt"0000"qt {print $11}' file

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to find pattern in file

Hi I am using awk to find the pattern from the file, but it is not displaying anything. Probably I am missing some syntax in expression. FILE xxxx.Merge.exchMon.BY.qTime 120 read xxxx.Merge.exchMon.BY.qStart 09:55 read... (9 Replies)
Discussion started by: sdosanjh
9 Replies

2. Shell Programming and Scripting

How can I use find command to search string/pattern in a file recursively?

Hi, How can I use find command to search string/pattern in a file recursively? What I tried: find . -type f -exec cat {} | grep "make" \; Output: grep: find: ;: No such file or directory missing argument to `-exec' And this: find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies

3. Shell Programming and Scripting

awk command to get file content until 2 occurrence of pattern match

AWK command to get file content until 3 occurrence of pattern match, INPUT FILE: JMS_BODY_FIELD:JMSText = <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <custOptIn xmlns="http://com/walm/ta/cu/ccs/xml2"> <person>Romi</person> <appName>SAP</appName> </custOptIn> ... (4 Replies)
Discussion started by: prince1987
4 Replies

4. Shell Programming and Scripting

Big pattern file matching within another pattern file in awk or shell

Hi I need to do a patten match between files . I am new to shell scripting and have come up with this so far. It take 50 seconds to process files of 2mb size . I need to tune this code as file size will be around 50mb and need to save time. Main issue is that I need to search the pattern from... (2 Replies)
Discussion started by: nitin_daharwal
2 Replies

5. Shell Programming and Scripting

How to include file pattern in find command?

Hi I've to remove the files which has the following file pattern in path /home/etc/logs fnm_HST_date1 fnm_hst_date1 fnm_HST_date2 I've used the following code to to remove the files having file names like "HST" . #!/usr/bin/ksh set -x file_path=/home/etc/logs file_nm=HST find... (2 Replies)
Discussion started by: smile689
2 Replies

6. Shell Programming and Scripting

How to find a file with a specific pattern for current sysdate & upon find email the details?

I need assistance with following requirement, I am new to Unix. I want to do the following task but stuck with file creation date(sysdate) Following is the requirement I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
Discussion started by: PreetArul
4 Replies

7. Shell Programming and Scripting

Find command to delete a pattern

Hi all i have a directory where it has files as shown below.Using find command how can i delete files which were modified more than 20 days ago and having the pattern jnhld15231 or jnhld15232. find ./ -name "jnhld15231^" -type f -mtime +20 -exec rm {} \; find ./ -name "jnhld15232^" -type f... (2 Replies)
Discussion started by: morbid_angel
2 Replies

8. Shell Programming and Scripting

awk to find pattern and add lines

My file goes like this: SID_LIST_HOSTNAME_LISTENER_3 = (SID_LIST = (SID_DESC = (SID_NAME = ORA0008) (ORACLE_HOME = /opt/oracle/product/ORA0008) (ENVS = "LD_LIBRARY_PATH=/opt/oracle/product/ORA0008/lib") ) (SID_DESC = (SID_NAME = ORA0007) ... (4 Replies)
Discussion started by: jpsingh
4 Replies

9. UNIX for Advanced & Expert Users

awk script, find pattern

I have a .csv file with columns. In column I like to find which rows contain a certain pattern. That is, my column is: CNR CP CSN CTC EF.DB.U CTC.A D.DB Here, I like to do one thing with EF.DB.U and another with all other. So my question is; how should my if... (3 Replies)
Discussion started by: lulle
3 Replies
Login or Register to Ask a Question