Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 530

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/cache.php on line 103

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/theme.php on line 623

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/custom_posts/custom_posts.php on line 22

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 46

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 67

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 75

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 92

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiRender.php on line 70

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 181

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 538

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 695

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 1087

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112
行番号つけるだけ | おれせか
おれせか

なんかそれっぽいのをうにうに。

macのterminalでワンライナー

対象の文をコピって

pbpaste | ruby -ne 'puts "#{$..to_s}\t#{$_}"' | pbcopy

rubyのオプションの-pと-nの差忘れないようにめも from:Rubyの起動

-n
このフラグがセットされるとプログラム全体が sed -nやawk のように

while gets

end

で囲まれているように動作します.

-p
-nフラグとほぼ同じですが, 各ループの最後に変数 $_ の値を出力するようになります。
例:

% echo matz | ruby -p -e ‘$_.tr! "a-z", "A-Z"’
MATZ

PAGETOP
PAGETOP
PAGETOP

Comments (14)

awk ‘{print NR, $0}’
なんてのでもいける。

そら
[2011/02/17 (木) 12:43]

awkとかsedむずかしくいよ(´・ω・`)
#どうでもいいけどgoogleIME、「しょぼーん」で↑の顔文字出せるんな!

[2011/02/17 (木) 15:39]

まぁruby使えるんならawkもsedも特に今から覚える必要はないね。
自分はAtok使いなのでGoogleIME使ったことないわー
(´・ω・`) 一応Atokでもでた。

そら
[2011/02/18 (金) 02:07]

inline-block同士の間に出ちゃうスペース(IE以外)の幅は
winでだいたい3px、macでだいたい4px。あばうと。

[2012/12/20 (木) 16:41]

フラグとほぼ同じですが, 各ループの最後に変数 $_ の値を出力するようになります。

[2014/01/02 (木) 11:09]

Д゚)!!!!

その手があ
俺もその手を使わせてもらいますわ

[2015/08/13 (木) 16:30]

ほんとはまとめて変換しないでちゃんと対象ファイルしっかり選んで変換したほうがきっといいよ!

[2015/09/16 (水) 13:05]

良い書き込み記事をありがとう!それは実際にはアミューズメントアカウントです。

[2015/11/23 (月) 17:46]

capタスクに追加された。
これで「cap deploy:seed」でdeploy先で「rake db:seed」できる(はず)。

[2016/01/06 (水) 17:50]

フラグとほぼ同じですが, 各ループの最後に変数 $_ の値を出力するようになります。

[2016/01/07 (木) 10:58]

宝のスーパーコピーめでたい(ミュウミュウ)。

[2016/01/15 (金) 17:43]

↑の記事を読んで、おおこりゃいいやと思いつつ使ってみた時に気づいたことメモ。

[2016/03/31 (木) 10:01]

ブランド激安は美玉を被って表して、

華の駿馬の靴の機械はずっと下流の企業が価値を効果と利益を上げて、バッグ創造するのが目的だと思って、

環境が自分のブランド激安力でできて貢献して社会の責任のバッグアンダーラインになりをすると思って、、

単に両針のフープのブランド激安完全の自動ルーマニアが人力車を引くバッグのがきわめて高い価格性能比の典型的な代表を備えるです。

[2016/05/21 (土) 11:56]

モデルのことができるので。

[2016/06/27 (月) 18:36]
PAGETOP

Comment Form

PAGETOP

Trackbacks (0)

トラックバックはありません。

PAGETOP

Trackback URL

PAGETOP

Search