Skip to content

Instantly share code, notes, and snippets.

@cqw25116
cqw25116 / 7Z-Command.md
Created August 5, 2014 12:52
7Z commnad

##7zコマンド

###7-Zip [64] 4.65 Copyright (c) 1999-2009 Igor Pavlov 2009-02-03

使用法: 7z <コマンド> [<スイッチ>...] <書庫ファイル> [<書庫ファイル>...] [<@リストファイル...>]

###<コマンド>

a: 書庫にファイルを追加する。Add files to archive

wgetでURL、ファイルが存在すれば 1 を、存在しなければ 0 を返す

wget -nv --server-response --spider http://www.google.co.jp/ 2>&1 | grep -c "200 OK"

  • ファイルが無い場合のwgetの出力の一部・・・ 1 HTTP/1.0 404 Not Found
  • ファイルが有る場合のwgetの出力の一部・・・ 1 HTTP/1.0 200 OK  
  • "200 OK" が有れば、ファイルがあるので、その行数は 0以外。  ファイルが無ければ 0 となる
  • ファイルが無い時に 404 以外を返すサーバーがあるみたい。 >- ファイルが有れば "200 OK"1 回・・・・  -nv 付けないと 2 が出力されとる。
@cqw25116
cqw25116 / peco.md
Created August 2, 2014 23:09
peco

pecoで選択した結果を変数へ入れて処理する

for /f %%i in ('dir /b ^| peco') do set abc=%%i & echo ECHO:!abc! 

  • pecoの結果の標準出力をファイルに書き出さないで、直接変数へ入れて処理を続ける。
  • この例の場合は前もって遅延環境変数をONにしておく       [CMD /V] or [SETLOCAL enabledelayedexpansion]

@cqw25116
cqw25116 / sed.md
Created August 2, 2014 23:09
SED (windows)

HTMLエンティティーをデコードして文字に戻す

  .bak 拡張子を付けて、バックアップをとる  -i.bak   対象ファイルを1つずつ読み込んで、置換を行う( -e をつけてダラダラ書く)

  ls | xargs sed -i.bak -e "s/\&amp;/\&/g" -e "s/\&lt;/</g" -e "s/\&gt;/>/g" -e "s/\&quot;/\""/g"

   &amp; ⇒ &    &lt; ⇒ < >>   &gt; ⇒ &gt;

@cqw25116
cqw25116 / linux command.md
Last active January 24, 2017 11:15
UNIXライクな環境を作る(URL)
@cqw25116
cqw25116 / wellcome document.md
Created August 2, 2014 22:48
Welcome document

Welcome to StackEdit! {#welcome}

Hello, I am your first Markdown document within StackEdit[^stackedit]. Don't delete me, I can be helpful. I can be recovered anyway in the Utils tab of the Settings dialog.


Documents