"以" in "敗義以求生， 豈荀巨伯所行邪" Does "以" have the same meaning in the following sentences?


  敗義以求生， 豈荀巨伯所行邪





  志士仁人 無求生以害仁
in &quot;敗義[以]求生， 豈荀巨伯所行邪&quot;,  '以' functions as  &quot;to&quot; in English
commit immoral act [to] survive, isn't something I (荀巨伯) would do
it makes no sense to interpret  it as &quot;commit immoral act with attempt of surviving&quot;

~

in &quot;志士仁人 無求生[以]害仁&quot;, '以' functions as &quot;with&quot; or &quot;by&quot; in English
principled and kind person, would not try to survive with immoral act
principled and kind person, would not try to survive by committing immoral act
it makes no sense to interpret  it as &quot;trying to survive to commit immoral act&quot;