sedコマンドでHTMLタグの中身を取得する

HTMLソースで以下のようなタグの場合、<h2>~</h2>に囲まれた「TEST」のみを取得したい場合ですが、sedコマンドを利用するとタグで囲まれた中身を取得できます
<h2>test< ...行頭にゼロに入った数値の文字列で0を解除する【シェルスクリプト】

0で埋められた「001」、「0010」等の文字列になっている数字で、先頭からある「0」を外したい場合があります。
sedコマンド「s/0*\(*$\)/ ...
シェルスクリプトの if文で複数の条件を指定する

シェルスクリプトでif文でAND条件やOR条件を複数指定したい場合ですが、以下のようにすればOKです
if文でAND条件の場合AND条件では「条件1 -a 条件2」と条件を「-a」を付与して続け ...
仮想マシンの時刻がずれが生じた場合(hwclock)

クラウドで運用しているサーバーで時刻が10分ほどずれているサーバーがありました。このクラウドではntpdやchronyで時刻同期をおこなっても、上位のどこかでNTPポート(123ポート)が閉じているようでNTPサーバーで時刻同期ができ ...
MySQLで、ユーザーのパスワード変更

MySQL、MariaDBでの登録していてるユーザーのパスワード変更するには、MySQLにログイン後に「SET PASSWORD 〜」と「mysqladmin」を利用する2つの方 ...
迷惑メール回避対策 DKIM設定【Postfix】

構築したメールサーバのメールがGmailで受信したメールが迷惑メール扱いになっていたりすることは無いでしょうか?
この対策として有効なのが、SPF(Send ...
Gmail、キャリア向けメール送信時に、Postfix 流量制限をする

docomo, au, softbank 等の携帯キャリア向けのメール、Gmailのメールなどは、大量のメールを送信されてると、「554:Transaction failed」等のエラーコードを応答してセッショ ...
wgetでcookieを利用して、ログイン認証のページにアクセスする

前回の「curlでcookie情報を取得・送信して利用する」と同様で、cookieを利用して、ログイン後のページにアクセスします。。今回は「wget」コマンドを使用してアクセスします。
curlでcookie情報を取得・送信して利用する

curlでログイン情報をPOST情報を送信してログインしたり、cookieを保存したり、送信する方法を説明します。
wgetコマンドで、cookie情報を保存・送信する場合「wgetで ...
systemctlでApache の「graceful」を使用する

CentOS 7.x , CentOS 8.xでは、サービスを起動する場合は、systemctlコマンドになっています。この状態でApacheのgracefulを使用すると「Unknown operation ‘grace ...
Apacheのバーチャルホストの一覧表示と内容確認

ApacheでVirtualHost で設定されているドメインの一覧や内容を確認するには、VirtualHost の設定ファイルを見ればわかりますが、複数のVirtualHost を設定している場合は、その設定ファイルを一個一個みるに ...
大きめのCSVファイルをアップロードして際のMySQLのエラー【MariaDB,MySQL】

MySQL(MariaDB)で、大きなCSVファイ ...
Curlでリクエスト中の進行状況を表示しない

curlでWEBページを保存する時に、オプションを指定しない場合は、下記のようにダウンロードできる進捗状況が表示されます。
通常にWEBページをダウンロードする場合はいいですが、シェルスクリプトでプログラムを実行している場 ...
grep コマンドで数字のみを表示する

数字と文字を含むテキストがあり、その中で数字のみを抽出したい場合の「grep -o ‘*’」のようにgrepコマンドを利用すれば利用できます
# grep -o '*'とすれば、数字のみを抽出できます$ ...viエディタでコロン「:」が打てない場合の対処方法

とあるクラウドサーバーで仮想マシンのクローンより新規仮想マシンを作成する作業がありました。
コピー元の仮想マシンが複数のディスクをマウントしており、コピー先のマシ ...