grep を使っていると、「マッチしないもの」が欲しいときがある。 マッチする文字列を除外する grep -v マッチさせる除外したい文字列 動作例 はてな のトップページから href を抜き出して、絶対URL( http://で始まる )を捨てて、絶対パス(/ で始まる。)だけにした。 takuya@pc7:~$ curl http://www.hatena.ne.jp | grep href | grep -v http | tail -n 20 <link rel="stylesheet" href="/css/simple-header.css" type="text/css" media="all"> <link rel="stylesheet" href="/css/portal-top.css?2010022217" type="text/css" media="all">