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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -