看板 Linux 關於我們 聯絡資訊
大家好, 我用 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 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.117.196.151 ※ 編輯: noodleT 來自: 140.117.196.151 (11/12 23:53)
yvb:你 find /tmp /mnt /proc /backup/tar 哪會得到 /sys/... ? XD 11/13 00:16
yvb:你一開始 find 先 cd / 再 find tmp mnt ... 就不會有 / 帶頭 11/13 00:18
yvb:或者 sed -i 's:^/::' exclude.filelist 內容就會去掉 / 帶頭 11/13 00:19
noodleT:謝謝,明天試試看 11/13 00:27
fjm31714:vim 打開 ^v G d :wq 收工 11/13 02:16
imcar:vim :%s/^.//g 11/13 09:12
jokester:ls | cut -c2- ; 11/13 09:53
fjm31714:@imcar 可以 :%s/.// 就好吧XD 11/13 15:57
rickieyang:@imcar, 都加 ^ 了,又加 g 有啥特別原因嗎? 11/13 23:59