| UNIX/Linux Forum Archives · Rules and Guidelines · Disclaimer |
Help
Search
Members
Calendar
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
![]() ![]() ![]() |
| seaten |
Posted: May 6 2005, 04:05 PM
|
|
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 ? |
| andyb1ack |
Posted: May 11 2005, 02:36 PM
|
|
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 $//" |
![]() |
![]() ![]() ![]() |