「check_attr_name」の版間の差分

提供: Personal Tukubai for Academic
ナビゲーションに移動 検索に移動
(Batch Update)
(アンダースコアのために DISPLAYTITLE を使用。)
 
1行目: 1行目:
 +
{{DISPLAYTITLE:check_attr_name}}
 +
 
== 名前 ==
 
== 名前 ==
  

2022年3月21日 (月) 23:35時点における最新版


名前

check_attr_name : name 形式データの属性をチェックする

書式

使い方とオプション

Usage

check_attr_name <check_file> <name_file>

Option

--through <string>
--ngword <ng_file>
--ngthrough

Attributes

n N (unsigned integer number)
s S (signed integer number)
f F (unsigned decimal fraction number)
v V (signed decimal fraction number)
e E (alphabetic characters)
a A (ASCII characters)
b B (alphabetic and numeric characters)
h H (half-width characters)
l L (half-width Katakana characters)
z Z (full-width characters)
k K (full-width Katakana characters)
x X (printable characters)
c C (check digit)
o O (non lower case letters)
j J (address letters = full-width + ASCII)
m M (email address)

説明

<check_file> に記述されているタグ名、属性の指定に従って <name_file>のデータをチェックします。属性には桁数を付加することができます。属性が大文字なら桁数に等しい値を、小文字なら指定桁数以下の値を要求します。

<name_file> のタグは、タグ名_数値 であれば、_数値部分を取り除いたタグ名のみでチェックをします。

エラーがあった場合は、すべてのタグをチェックした後にエラー終了し、標準出力にタグ名と属性+桁数を出力します。–ngthrough を指定したときは、エラーが有っても正常終了します。

オプション

–through <string <name_file> のデータが <string> のうちいずれかに等しい場合は、チェックを実施しません。<string>のデフォルトは "_" です。このオプションを繰り返し使って複数の <string> を指定することができます。

–ngword <ng_file> z Z x X j J において、<ng_file> に記述されているマルチバイト文字はエラーとします。<ng_file> には、1行に1文字記述します。

例(その1)

通常のチェックは次の通りです。

$ cat check
A N3            <-- 3桁整数
B n4            <-- 4桁以下の整数
C x3            <-- 3桁以下の文字
D X6            <-- 6桁の文字

$ cat data
A 200
B 12345
C abcde
D_001 xxxxxx    <--+- "D 6X" としてチェックされます
D_002 xxxxx     <--+
D_003 xxxx      <--+
$ check_attr_name check data
B n4
C x3
D_002 X6
D_003 X6
$ echo $?
1

例(その2)

–through オプションでチェックしない値を指定します。

$ cat data2
A 200
B @
C @
D_001 xxxxxx
D_002 @
D_003 @
$ check_attr_name --through @ check data2
$ echo $?
0

例(その3)

–ngthrough オプションで常に正常終了します。

$ cat data3
A 123
B 12345
$ check_attr_name check data3
B n4
$ echo $?
1
$ check_attr_name --ngthrough check data3
B n4
$ echo $?
0

Version and Edition

Fri Jan 15 10:07:11 JST 2021

1


© 2021 Universal Shell Programming Laboratory site