You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
まえがき sedで環境に依存しないワンライナーを書きたかったけど、BSDとGNUの実装で微妙に挙動が違うせいで難しかった。で、いっそのことperlで書いた方がいいのでは、という結論になった。ぐぐったらperlのワンライナーの書き方出てくるけど何でそう動くのか分からなかったのでそれも調べた。そこらへんについてまとめる。 GNU sedとBSD sedの違い、perlからsedへの乗り換え方簡易版、その詳細、という感じでまとめたので知りたいところからどうぞ。 sedにはGNU sedとBSD sedがある sedで とかしようとすると実行する環境によって失敗する。 sedにはBSDの実装とGNUの実装があるからだ。-EはBSD sedで拡張正規表現を使うオプションで、GNU sedで拡張正規表現を使いたければ-rを使う必要がある。 じゃあ拡張正規表現を使わずにデフォルトの正規表現を使えばいいの
Skip to the content. Bash-Oneliner I am glad that you are here! I was working on bioinformatics a few years ago and was amazed by those single-word bash commands which are much faster than my dull scripts, time saved through learning command-line shortcuts and scripting. Recent years I am working on cloud computing and I keep recording those useful commands here. Not all of them is oneliner, but i
#!/bin/sh urlencode() { # https://qiita.com/ik-fib/items/cc983ca34600c2d633d5 echo "$1" | nkf -WwMQ | sed 's/=$//g' | tr = % | tr -d '\n' } HOST="jp-east-1.computing.api.nifcloud.com" ACCESS_KEY="<YOUR ACCESS KEY>" SECRET_KEY="<YOUR SECRET KEY>" TIMESTAMP="`date -u +'%FT%T.%2NZ' | sed -e 's/:/%3A/g'`" declare -A params=( ["Action"]="DescribeVolumes" ["VolumeId.1"]="VolumeId" ["SignatureMethod"]="H
I have some script that produces output with colors and I need to remove the ANSI codes. #!/bin/bash exec > >(tee log) # redirect the output to a file but keep it on stdout exec 2>&1 ./somescript The output is (in log file): java (pid 12321) is running...@[60G[@[0;32m OK @[0;39m] I didn't know how to put the ESC character here, so I put @ in its place. I changed the script into: #!/bin/bash exec >
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く