Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102129473
check_list
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 17, 09:35
Size
941 B
Mime Type
text/x-shellscript
Expires
Wed, Feb 19, 09:35 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24288742
Attached To
R1066 amc-cape
check_list
View Options
#!/bin/bash
function
USAGE
()
{
echo
"USAGE: $0 csv_list.csv"
;
exit
1
}
SOURCE
=
$1
if
[
! -r
$SOURCE
]
;
then
echo
"File not found: $SOURCE"
>2; USAGE;
fi
function
fetch_data
()
{
local
sciper
=
$1
local
cache_file
=
"./cache/${sciper}.txt"
if
[
! -f
$cache_file
]
;
then
./search-epfl -s
$sciper
>
$cache_file
DATA
=
$(
./search-epfl -s
$sciper
| tr
'\n'
'~'
)
;
fi
DATA
=
$(
cat
$cache_file
| tr
'\n'
'~'
)
}
function
get_field
()
{
local
field
=
$1
echo
$DATA
| tr
'~'
'\n'
| grep
"^$field:"
| cut -d
':'
-f 2-
}
IFS
=
$'\n'
id
=
0
for
l in
$(
cat
$1
)
;
do
((
id++
))
sciper
=
$(
echo
$l
| cut -d
','
-f 1
)
rest
=
$(
echo
$l
| cut -d
','
-f 2-
)
fetch_data
$sciper
section
=
$(
get_field
'section'
)
name
=
$(
get_field
'cname_usual'
)
status
=
"OK"
;
if
[
-z
"$section"
]
;
then
section
=
$(
echo
$l
| cut -d
','
-f 3
)
;
status
=
"NOT FOUND"
;
fi
if
[
-z
"$name"
]
;
then
name
=
$(
echo
$l
| cut -d
','
-f 2
)
;
fi
echo
"$id,$sciper,$name,$section,$status,$rest"
done
Event Timeline
Log In to Comment