去掉文件的第一個字元 - Linux

Table of Contents


大家好,

我用 find /tmp /mnt /proc /backup/tar -name '*' ! -type d > exclude.filelist

得到如下的檔案內容:

/sys/devices/platform/uevent
/sys/devices/platform/power/wakeup
/sys/devices/platform/pcspkr/uevent
/sys/devices/platform/pcspkr/power/wakeup
/sys/devices/platform/pcspkr/modalias

但我想把"每一行"的第一個'/'去除,請問有什麼相關的指令可以使用呢?

--

我是麵T,哩賀
http://ppt.cc/-eS5

--

All Comments

Hedy avatarHedy2013-11-15
你 find /tmp /mnt /proc /backup/tar 哪會得到 /sys/... ? XD
Linda avatarLinda2013-11-19
你一開始 find 先 cd / 再 find tmp mnt ... 就不會有 / 帶頭
Andy avatarAndy2013-11-24
或者 sed -i 's:^/::' exclude.filelist 內容就會去掉 / 帶頭
Charlotte avatarCharlotte2013-11-26
謝謝,明天試試看
Emily avatarEmily2013-11-27
vim 打開 ^v G d :wq 收工
Hazel avatarHazel2013-11-30
vim :%s/^.//g
Andrew avatarAndrew2013-12-01
ls | cut -c2- ;
George avatarGeorge2013-12-06
@imcar 可以 :%s/.// 就好吧XD
Andy avatarAndy2013-12-08
@imcar, 都加 ^ 了,又加 g 有啥特別原因嗎?