az @Wiki
sed
最終更新:
az
-
view
TIPS
- 行を削除する
sed -e '1d' list.txt # 1行目 sed -e '1,5d' list.txt # 1~5行目 sed -e '$d' list.txt # 最終行
- カレントディレクトリから実行されたファイルまでの相対パス取得
print $0|sed -e "s/\(.*\)\/\(.*\)$/\1/"
- 頭の0を削除する
echo 001 | sed -e "s/\(^0\{1,\}\)\(.*\)/\2/"
- 頭の数字8文字を抜き出す
cat list.txt | sed -e "s/^\([0-9]\{8\}\).*/\1/"
- シングルクオートをエスケープする
sed -e 's/"/'\''/g' file