BASH: テキストファイルの読込と文字変換一括処理
文字起こしツールのテキストが、1行で作成されていたり、「えー」「あのー」などを削除する必要があった為、BASHで テキストファイルの読込と文字変換一括処理を実施するプログラムを作成
stringBatchReplaace.sh
#!/bin/bash
# stringBatchReplaace.sh
# 作業ディレクトリの定義
DIR=./
# 作業ディレクトリ内の.txtファイルに対して、文字一括変換処理後、*_edited.txtファイルとして保存
for pathfile in $DIR/*.txt; do
echo $pathfile
edit=${pathfile%.*}_edited.txt
cp -f $pathfile $edit
echo "。の後に改行コードを挿入"
sed -i -e 's/。/。\r\n/g' $edit
echo "あのーを削除"
sed -i -e 's/あのー//g' $edit
echo "えっとを削除"
sed -i -e 's/えっと//g' $edit
echo "えーとを削除"
sed -i -e 's/えーと//g' $edit
echo "えーを削除"
sed -i -e 's/えー//g' $edit
done
exit
Tailwind CSS & クラスレスCSS
ちょっとしたHTMLを、素早く意図通りのデザインとなるようミニマルに作成する
クラスレスCSSのデザインをCDNで読込み、ベースデザインとする
併せてtailwindcssをCDNで読込み、意図通りのデザインに修正していく
Tailwind CSS
クラスレスCSSのデザインをCDNで読込み、ベースデザインとする
併せてtailwindcssをCDNで読込み、意図通りのデザインに修正していく
Tailwind CSS
https://tailwindcss.jp/
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
クラスレスCSS sakura
https://oxal.org/projects/sakura/
<link rel="stylesheet" href="https://unpkg.com/sakura.css/css/sakura.css" type="text/css">
[CentOS/Samba/Bash] ディレクトリ、グループ、ユーザー、Sambaユーザー、シェルスクリプトで一括登録
CentOS7サーバーのSamba4に、階層構造組織のディレクトリ、グループ、ユーザー、Sambaユーザーをシェルスクリプトで一括登録する
前提条件
- CentOS 7.8 インストール済み
- Samba 4.0 インストール済み
ディレクトリ一括作成
複数のディレクトリを一括作成する場合、directorylist.dat にディレクトリのリストを作成し、シェルスクリプトでバッチ処理するmakedirectory.sh
#makedirectory.sh
#!/usr/bin/bash
echo -e "Make Directory is Started\n"
while read row; do
column1=`echo ${row}`
echo -e "パス ${column1} のディレクトリを作成します"
mkdir ${column1}
echo -e "作成完了しました\n"
done < directorylist.dat
# 所有者の変更と結果確認
chown -R username01:groupname01 /home/group-share/
ls -la /home/group-share/
directorylist.dat
/home/group-share
/home/group-share/株主総会
/home/group-share/取締役会
/home/group-share/内部監査
/home/group-share/社長室
/home/group-share/社長室/経営企画課
/home/group-share/営業部
/home/group-share/営業部/営業課
/home/group-share/営業部/支援課
/home/group-share/管理部
/home/group-share/管理部/総務課
/home/group-share/管理部/経理課
/home/group-share/管理部/人事課
/home/group-share/情報システム部
/home/group-share/情報システム部/設計開発課
/home/group-share/情報システム部/保守管理課
グループの一括作成
複数のグループを一括作成する場合、linuxgrouplist.dat にグループIDとグループ名称のリストを作成し、シェルスクリプトでバッチ処理するgrjoupadd.sh
#groupadd.sh
#!/usr/bin/bash
echo -e "Group Add is Started\n"
while read row; do
column1=`echo ${row} | cut -d , -f 1`
column2=`echo ${row} | cut -d , -f 2`
echo -e "group id : ${column1} , groupe name : ${column2}"
groupadd -g ${column1} -o ${column2}
echo -e "Registration completed\n"
done < linuxgrouplist.dat
# グループの登録結果確認
cat /etc/group
linuxgrouplist.dat
100001,groupnmame01
100111,stockholders-div
100112,directors-div
101001,manage-dep
118013,accounting-sec
119032,infomation-sec
118024,business-sec
ユーザーの一括作成
複数のグループを一括作成する場合、linuxuserlist.dat にグループIDとグループ名称のリストを作成し、シェルスクリプトでバッチ処理するnewusers コマンド
# newusers linuxuserlist.dat
# cat /etc/passwd
linuxuserlist.dat
- ユーザー名はLinuxユーザーとSambaユーザーで合わせる
- Linuxグループを先に作成しておく
- ユーザー名:パスワード:ユーザーID:グループID:GCOS(コメント):ホームディレクトリ:シェル
linuxuserlist.dat
# linuxuserlist.dat
ABEKAWA:9Hwle39j:117007:117007::/home/ABEKAWA:/usr/bin/bash
username01:password01:18001:30301::/home/username01:/usr/bin/bash
username02:password02:18002:30301::/home/username02:/usr/bin/bash
username03:password03:19003:30311::/home/username03:/usr/bin/bash
username04:password04:20011:20201::/home/username04:/usr/bin/bash
username05:password05:21035:40401::/home/username05:/usr/bin/bash
sambaユーザーの一括登録
たくさんのsambaユーザーを一括登録する場合、予めユーザー・パスワードリストテキストファイル(sambauseerlist.dat)に作成しておき、それを読込んで1行ずつループ処理させていくシェルスクリプトを作成sambauseradd.sh
#sambauseradd.sh
#!/usr/bin/bash
echo -e "Samba User Add is Started"
while read row; do
column1=`echo ${row} | cut -d , -f 1`
column2=`echo ${row} | cut -d , -f 2`
echo -e "username : ${column1} , password ${column2}"
echo -e "${column2}\n${column2}" | pdbedit -a -t -u ${column1}
echo -e "${column1} has been registered to Samba\n"
done < sambauserlist.dat
# sambaユーザーの登録結果確認
pdbedit -L
sambauserlist.dat
- ユーザー名はLinuxユーザーとSambaユーザーで合わせる
- ユーザー名,パスワード
# sambauserlist.dat
ABEKAWA,9Hwle39j
username01,password01
username02,password02
username03,password03
username04,password04
username05,password05
username06,password06
新規MarkdownファイルをWindowsのコンテキストメニューから作る [.md]
新規MarkdownファイルをWindowsのコンテキストメニューから作るhttps://qiita.com/kekenonono/items/3a2873d0a134160b4f4f
Windows10 右クリックメニューで表示される新規作成内の項目を削除する方法https://win-plus.net/windows10_system_context_menu_entry