UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old November 4th, 2004, 10:31 PM
arun0000 arun0000 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 35 arun0000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 35 m 46 sec
Reputation Power: 4
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

Reply With Quote
  #2  
Old November 5th, 2004, 06:12 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,077 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 13 h 40 m 11 sec
Reputation Power: 8
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)

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > awk help please


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway