我的脚本出了问题。我必须用参数运行脚本。例如:
"at 10 2000 was born Mark,Jordan"
我应该得到这个:
2000
01 Jane,Marry
02 Jason,Ted
.
.
.
12 Stephen,Victor
必须从列表中加载名称,例如:
ListOfNames:
src/sass
我不知道该怎么做。有人能帮助我吗?
答案 0 :(得分:0)
实际上我会将数据格式更改为:
In [98]: C = B - A
In [99]: C
Out[99]:
<3x6 sparse matrix of type '<class 'numpy.int32'>'
with 4 stored elements in Compressed Sparse Row format>
In [100]: C.A
Out[100]:
array([[0, 0, 0, 0, 1, 0],
[0, 1, 0, 0, 0, 0],
[1, 0, 1, 0, 0, 0]], dtype=int32)
它会真正简化脚本。在这种情况下,它将如此简单:
2000-01 Jane,Marry
2000-02 Jason,Ted
.
.
.
2000-12 Stephen,Victor
答案 1 :(得分:0)
你也可以尝试这个
seen=$(sed -n '/'"$2"'/{:A;n;/'"$1"'/!bA;s/^[^ ]* //;p;q}' ListOfNames)
[ -n "$seen" ] && echo "at $1 $2 was born $seen"