如何將你代碼中的行號透過 bash/sed 移除掉

有時在處理文字檔案時,因為複製貼上,都會連行號一起貼過來,有時又懒的對文字一行一行刪行號,所以透過 sed  來進行行的處理是最方便的.示例如下

此例中是要將每一行的前置6個字元都刪除掉.

# sed -i 's/^.\{6\}//' my_triangle.c

my_prfix_line_number_coderemove_prfix_line_number_code

Author: jerryw1974

learning and focus on computer science, cloud infrastructure, virtualization and information security, technical, networking,platform system and cyber-security related topic.