0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

かいはつめもさまねこ

Last updated at Posted at 2023-06-02

かいはつめもさまねこ

Linuxコマンド

// タイムゾーン設定と確認
export TZ="Asia/Tokyo"
echo $TZ

// lsしたファイル数をカウントする
ls | wc -l

// ファイルの行数をカウントする
cat file.txt | wc -l

// lsした時のファイルのみの一覧を表示する
ls | awk {print $1}

// zipファイル一覧を全て解凍するようなシェルを作るコマンド
ls | awk {print $1} | sed -E 's/^/unzip /g' > go.sh;sh go.sh

// 指定したファイル以外を削除するコマンド ※ファイル以外のディレクトリも削除されることになるので注意する
find . -type f | grep -v -E '*_5303946_*' | xargs rm -rf

// 実行中のexeの使用率を2秒毎に監視する
top -d 2 | grep TestApp

//catしてファイル内の行数をカウントする
ls | awk '{print $1}' | sed -E 's/^/cat /g' | sed -E 's/$/ | wc -l/g' > go.sh;sh go.sh

//ファイル分割
split -b 200M file.txt

//gzファイルの解凍
gzip -d xxx.gz

//サブディレクトリ配下のファイルをgrepする
find . -type f -print | xargs grep ""

AWSコマンド

//ファイルサイズ表示コマンド
aws s3 ls [S3バケット名] --recursive --human-readable --sum

//Ctrファイル一括削除コマンド
aws s3 ls [S3バケット名] | grep ERREND | sed -E 's#^.* +#[S3バケット]#g' > go.sh;sh go.sh;rm go.sh

秀丸エディタ正規表現

//1文字ずつタブを入れる
(.+?)
を
\1\t

プログラム

//mkdirでディレクトリが作成できない場合
⇒普通にインクルードできているかをチェックしよう(インクルードしていなくてもビルドが通ってしまう為)

参考URL
https://yu-nix.com/archives/c-mkdir-rmdir-stat/#Linux%E3%81%A7%E3%81%AE%E3%83%95%E3%82%A9%E3%83%AB%E3%83%80%E4%BD%9C%E6%88%90


//templeteについて
sizeof(X)
⇒環境によってはlong型のサイズが変わってしまうので注意する。

//10進数、0詰め、桁指定のprint

int value = 100;
std::cout << "value=" << std::dec << std::setfill('0') << std::setw(3) << value << std::endl;

16進数のprintは0x付けるとよい
std::cout << "value=0x" << std::hex << value << std::endl;

※改行する場合は末尾に¥記号

//char型の変数に格納した数値をstd::outで標準出力確認できない(標準出力ログをリダイレクトしても確認できない)
⇒int型の変数に設定後にstd::outすればよい。

unsigned char uc_num = 100;
std::out << (int)uc_num << std::endl;
とか、int型の変数に設定後にすればよい。

unsigned int ui_num = 0;
ui_num = uc_num;
std::out << ui_num << std::endl;

//vectorのソート優先順付け
struct 


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?