sed + replace only if match the first word in line -


the following sed command replaces old string new string. target replace old new if command word appears first word in line. how fix sed syntax in order replace old new if command first word in line? (note: command word location after spaces line beginning.)

lidia

sed "/^ *#/b; /command/ s/old/new/g"  file    command old   old command 

after sed exe:

  command new   new command 

"/^[ \t]*command/ s/old/new/g" 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -