N行目だけ表示する
1行目だけ表示する
sed -n 1p < data/ladies_tokyo.csv
N行目だけ削除する
-
d
コマンドを使う
1行目だけ削除する
sed '1d'
2行ずつ読み込んで1行で表示する
-
N
コマンド(入力の次の行をパターンスペースに読み込む)を使う - 「現在の行」と「次の行」をパターンスペースに読み込んでいる状態で、パターンスペースに対して改行を改行以外の文字に置換すると、2行が1行になる
$ printf 'aaa\nbbb\nccc\nddd\n' | sed 'N; s/\n/ /g'
aaa bbb
ccc ddd
from: http://blog.livedoor.jp/morituri/archives/52036613.html
yyyymmddHHMMSS
をyyyy-mm-dd HH:MM:SS
に変換する
utconv
というコマンドの出力がこれなので人間に見やすい形式に変換したい。
$ utconv -r 1574650550 | sed 's/^\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)$/\1-\2-\3 \4:\5:\6/'
2019-11-25 11:55:50
改行で置換する
<RS>
<US>
などの不可視文字で置換してからtr
で改行文字(LF
)と入れ替える。
$ RS="$(printf '\036')"; (tr -d '\n' | tr -s ' ' | sed 's/\. /\.'${RS}'/g' | tr ${RS} '\n') <<'EOF'
Include the specified configuration file(s). Multiple pathnames
may be specified and each pathname may contain glob(7) wildcards
and, for user configurations, shell-like `~' references to user
home directories. Files without absolute paths are assumed to be
in ~/.ssh if included in a user configuration file or /etc/ssh if
included from the system configuration file. Include directive
may appear inside a Match or Host block to perform conditional
inclusion.
EOF
Include the specified configuration file(s).
Multiple pathnames may be specified and each pathname may contain glob(7) wildcards and, for user configurations, shell-like `~' references to user home directories.
Files without absolute paths are assumed to be in ~/.ssh if included in a user configuration file or /etc/ssh if included from the system configuration file.
Include directive may appear inside a Match or Host block to perform conditional inclusion.