Powered by Invision Power Board


  Reply to this topicStart new topicStart Poll

> TOKENS IN UNIX
seaten
Posted: May 6 2005, 04:05 PM
Quote Post


Newbie
*

Group: Members
Posts: 1
Member No.: 976
Joined: 6-May 05



im trying to remove all occurences of " OF xyz " in a file where xyz could be any word assuming xyz is the last word on the line but I won't always be.

at the moment I have sed 's/OF.*//'

but I want a nicer solution which could be in pseudo code


sed 's/OF.* (next token)//'


Is that possible ?
PMEmail Poster
Top
andyb1ack
Posted: May 11 2005, 02:36 PM
Quote Post


User Level: 4
****

Group: Members
Posts: 98
Member No.: 513
Joined: 9-September 04



How about
"s/ OF .* $//"
or
"s/ OF [A-Za-z][A-Za-z]* $//"

I guess you could pass the pseudo code in as a variable too:
"s/ OF $STRING $//"
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | General UNIX/Linux Forum | Next Newest »

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.0463 ]   [ 12 queries used ]   [ GZIP Enabled ]




Partners: Cambridge Plus :: <Link Available> :: PIC Boot Loader :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum