Awking


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Awking
# 1  
Old 02-08-2009
Awking

Could someone find out wht exactly is goin wrong in the following awk:

awk '/${EDW_DB_SCHEMA}.WRKR/ || !/otable/&&/${EDW_DB_SCHEMA}.WRKR/ || !/db-ter-load-data/&&/${EDW_DB_SCHEMA}.WRKR/' <my_graph>.ksh

Basically, I am trying to achieve:
Find out the occurence of WRKR table in <my_graph>.ksh and at the same time AVOID the following combinations:
1.'otable' and ${EDW_DB_SCHEMA}.WRKR
2.'db-ter-load-data' and ${EDW_DB_SCHEMA}.WRKR

and the WRKR table appears as "${EDW_DB_SCHEMA}"'.WRKR' in the korn shell(.ksh) and also, I am looping thru a list of ksh files under a given dir as I don't know which ksh file uses this table..

hope this is clear !
pls suggest !
-Anduzzi
# 2  
Old 02-08-2009
${EDW_DB_SCHEMA} won't expand within single quotes.

Jerry
# 3  
Old 02-08-2009
Here's the general idea, but you'll have work out your binary logic as I think the conditions are repetitive....
Code:
awk -v db="${EDW_DB_SCHEMA}" '$0 ~ (db ".WRKR") || !/otable/ && $0 ~ (db ".WRKR") || !/db-ter-load-data/ && $0 ~ (db ".WRKR")' *.ksh

# 4  
Old 02-09-2009
Hi Vgersh,
Thanks for your inputs !.
Could you please explain the $0 in that command?...its not quite working at my end...I understand that you have defined a variable and used it thru out but not quite gettig the syntax...please explain !

-Anduzzi
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awking binary data

i have a binary data that has some text in it. what i want to do is, i want to grab just piece of information from the binary. but when i run my awk on it, it returns nothing. awk -F"MYINFO=" '{print $2}' mybinary however, when i install gawk, then try again, it works. i would prefer... (1 Reply)
Discussion started by: SkySmart
1 Replies

2. Shell Programming and Scripting

Awking custom output

i have data that can look like this: echo "Master_Item_Service_is_down=0_njava_lang_NoClassDefFoundError=0_njava_lang_OutOfMemoryError=1_nemxCommonAppInitialization__Error_while_initializing=0_nINFO__Stopping_Coyote_HTTP_1_1_on_http_8080=7_nThe_file_or_directory_is_corrupted_and_unreadable=0_n" ... (7 Replies)
Discussion started by: SkySmart
7 Replies

3. Shell Programming and Scripting

Grepping or awking multiple lines in a file - regex

data.txt: hellohellohello mellomello1mello tellotellotellotello bellobellowbellow vellow My attempts: egrep ".*mello1\n.*bellow" data.txt awk '/.*mello1.*\nbellow/' data.txt how can i search for patterns that are on different lines using simple egrep or awk? i only want the... (7 Replies)
Discussion started by: SkySmart
7 Replies

4. Shell Programming and Scripting

Awking string only 6 character long and providing a count

Morning Guys, I am attempting to awk a file which strings in the file is only 6 characters long and not more. Currently it is counting every line and giving a count of 59, but it should be 57 (not including the long baracode - 004705CIM*****) " awk '/./ {cnt++} END {print cnt}'... (11 Replies)
Discussion started by: Junes
11 Replies

5. Shell Programming and Scripting

Help awking a 'head -1 file.txt' input

Hi there, my ksh script collects a procstack trace for a particular pid and then greps it by a transaction id to find out the pthread ID: ---------- tid# 1876087 (pthread ID: 4466) ---------- So the pthread ID I want is 4466 in this case, and it is assighed to the variable $pthread.... (4 Replies)
Discussion started by: tmf33uk
4 Replies

6. Shell Programming and Scripting

awking two columns based on symbols

The input file has 3 columns. the first column with low values second with bigger.If the symbol is - in third column the numbers have to change the least in column1 and highest in col2. Input col1 col2 col3 1 2 + 2 3 - 3 4 + 5 6 - Output col1 col2 col3 1 2 + 3 2 - 3 4 + 6 5 - The... (2 Replies)
Discussion started by: stateperl
2 Replies

7. Shell Programming and Scripting

awking two columns

Hey ppl I have two columns with random values. i need to insert the 1st row of the first column with the highest number of the two rows in the first column and vice versa. some thing like this. I'm sorry If my question is unclear...:rolleyes: input col1 col2 12...11 11...14 34...45... (11 Replies)
Discussion started by: sophiesophie
11 Replies

8. Shell Programming and Scripting

Help with awking

Hi... How does awk or sed or even grep extract the following string out of my text file?. '"${ETL_VW_SCHEMA}"'.IATA_STN_TZ_UTC_LCL_CONV_CV '"${ETL_VW_SCHEMA}"'.CO '"${ETL_VW_SCHEMA}"'.TEST_CO I just need to extract the second entry which means I need to let awk know I am just searching for... (5 Replies)
Discussion started by: anduzzi
5 Replies

9. Shell Programming and Scripting

awking and grepping parts of files: the 'super diff'

OKAY---- Here's what I must do. I have two files. I need to compare the two files such as with the diff command. I am adding FILENEW to FILEOLD If fields $1, $2, $5, and 6 are the same, then I don't want to add FILENEW records to FILEOLD. If they are not, then append the lines. Is... (11 Replies)
Discussion started by: jeffpas
11 Replies

10. Shell Programming and Scripting

Awking!! Printing decimal output is struck

Hi friends, I have a small problem with AWK. I am not able to print decimal values! :confused: below is my code: #! /bin/awk -f awk BEGIN{printf("%d",123)}; -> This prints the integer properly. x=111 awk BEGIN{printf("%d",x)}; -> This doesnt print! :( Please help me solve this. It... (4 Replies)
Discussion started by: divzz
4 Replies
Login or Register to Ask a Question