1
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 3 years have passed since last update.

でかすぎる改行なしのsitemap.xml内のURLをLinuxコマンドで調べる

Posted at

でかすぎる改行なしのsitemap.xml内にurlがいくつ書いてあるか調べたくて、Linuxコマンドでサクッとやってみた。

</url> の後に改行コード入れて、行数を調べることで判定してみる。

sedの出力で改行コードを出すのに\nとか入れてみてもnと文字が出てしまうので、結局コマンドラインから改行そのものを入れた。ダブルクオートではなくシングルクオートで囲まないとうまくいかない。改行前の\も忘れずに。

$ cat sitemap.xml | sed -e 's/<\/url>/<\/url>\
/g' | wc -l

出てきた数値−1がurlの数、のはず。

1
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
1
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?