|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
awk help please
hi, I am trying to use awk to get all the functions out from any input file.
This is how the file looks like. //this is test. this is test. /*this is test*/ main() op() go(come()) following is my awk shell script. sed '/for/ d'| sed '/if/ d' | sed '/while/ d' | awk '/\(.*\)/ {print}' this gives me the output of main() op() go(come()) I would like to seperate the go(come()) functions and print them out on seprate lines. any help on this would be appreciated. Thanks |
|
#2
|
|||
|
|||
|
your awk script is NOT an awk script
but a very confused cascade of sed and awk doing nothing ![]() --------------------- following is my awk shell script. sed '/for/ d'| sed '/if/ d' | sed '/while/ d' | awk '/\(.*\)/ {print}' ------------------ 1) the space between '/' an 'd' maybe works ON YOUR system, not on mine. 2) you are seeking for 'for,if,while' what about 'forever,indifferent' (no exp for while, english is not my language) 3) if you want cut out a 'for' do it correctly sed '/\<for/>/d' this means a 'for' not a 'aaaforbbb' 4) the awk statement cause me probls, what do you mean? you sure are confusing sed and awk syntax. \(.*\) make sence in sed, vi, ed, ex ..... what should that be in awk ??? 5) did you already encounter the ';' op in sed ? well documented (read man pages) 6) at least, to do that job use A sed or AN awk both can it (sed is faster) |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > awk help please |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|