extract values from text file generated from excel spreadsheets
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have 500 text files like the one below, I got these files by converting Excel spreadsheets to csv files using ssconvert
.
Now, I would like to extract two numbers from these text files, and I can't figure out how? I tried sed
and awk
with no hope.
I am sure it is very easy for you to help me extract these numbers and I appreciate any support.
quant_param,81200000,1.33E-05,0.00178117,3.82E-07,,Dosagepharmaceutical,,,"Patient weight (lbs)"
,,,,,,"Initial Infusion (ml)",14.87,,140
"Infusion Time",10:40:01,TOF:,10:40:13,"14.23 ml",,"End time",10:39:18,,63502.9318
"Caclulation Time",10:40:01,,,,,,0:00:43,,"Patient Height (in)"
t1,0:00:00,,,,,,43.0000000000035,,60
,0,,,,,"Residual Activity (mCi)",0.18,,1.524
These are part of each file, I would like to learn how to extract number <14.87> from the second line, number <14.23 ml> from the third line and number <1.524> from the last line.
text-processing
New contributor
add a comment |Â
up vote
0
down vote
favorite
I have 500 text files like the one below, I got these files by converting Excel spreadsheets to csv files using ssconvert
.
Now, I would like to extract two numbers from these text files, and I can't figure out how? I tried sed
and awk
with no hope.
I am sure it is very easy for you to help me extract these numbers and I appreciate any support.
quant_param,81200000,1.33E-05,0.00178117,3.82E-07,,Dosagepharmaceutical,,,"Patient weight (lbs)"
,,,,,,"Initial Infusion (ml)",14.87,,140
"Infusion Time",10:40:01,TOF:,10:40:13,"14.23 ml",,"End time",10:39:18,,63502.9318
"Caclulation Time",10:40:01,,,,,,0:00:43,,"Patient Height (in)"
t1,0:00:00,,,,,,43.0000000000035,,60
,0,,,,,"Residual Activity (mCi)",0.18,,1.524
These are part of each file, I would like to learn how to extract number <14.87> from the second line, number <14.23 ml> from the third line and number <1.524> from the last line.
text-processing
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have 500 text files like the one below, I got these files by converting Excel spreadsheets to csv files using ssconvert
.
Now, I would like to extract two numbers from these text files, and I can't figure out how? I tried sed
and awk
with no hope.
I am sure it is very easy for you to help me extract these numbers and I appreciate any support.
quant_param,81200000,1.33E-05,0.00178117,3.82E-07,,Dosagepharmaceutical,,,"Patient weight (lbs)"
,,,,,,"Initial Infusion (ml)",14.87,,140
"Infusion Time",10:40:01,TOF:,10:40:13,"14.23 ml",,"End time",10:39:18,,63502.9318
"Caclulation Time",10:40:01,,,,,,0:00:43,,"Patient Height (in)"
t1,0:00:00,,,,,,43.0000000000035,,60
,0,,,,,"Residual Activity (mCi)",0.18,,1.524
These are part of each file, I would like to learn how to extract number <14.87> from the second line, number <14.23 ml> from the third line and number <1.524> from the last line.
text-processing
New contributor
I have 500 text files like the one below, I got these files by converting Excel spreadsheets to csv files using ssconvert
.
Now, I would like to extract two numbers from these text files, and I can't figure out how? I tried sed
and awk
with no hope.
I am sure it is very easy for you to help me extract these numbers and I appreciate any support.
quant_param,81200000,1.33E-05,0.00178117,3.82E-07,,Dosagepharmaceutical,,,"Patient weight (lbs)"
,,,,,,"Initial Infusion (ml)",14.87,,140
"Infusion Time",10:40:01,TOF:,10:40:13,"14.23 ml",,"End time",10:39:18,,63502.9318
"Caclulation Time",10:40:01,,,,,,0:00:43,,"Patient Height (in)"
t1,0:00:00,,,,,,43.0000000000035,,60
,0,,,,,"Residual Activity (mCi)",0.18,,1.524
These are part of each file, I would like to learn how to extract number <14.87> from the second line, number <14.23 ml> from the third line and number <1.524> from the last line.
text-processing
text-processing
New contributor
New contributor
edited 13 mins ago
Goro
9,41464589
9,41464589
New contributor
asked 24 mins ago
Megan Wise
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
awk
can do this job:
awk -F',' 'NR==2print $10' file
140
awk -F',' 'NR==3print $5' file
"14.23 ml"
awk -F',' 'NR==6print $10' file
1.524
If all the 500 files have the same format, meaning they share the same line number, then you can loop these commands over all the files.
In the comments above, NR
represent the line number and -F
is the field separator.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
awk
can do this job:
awk -F',' 'NR==2print $10' file
140
awk -F',' 'NR==3print $5' file
"14.23 ml"
awk -F',' 'NR==6print $10' file
1.524
If all the 500 files have the same format, meaning they share the same line number, then you can loop these commands over all the files.
In the comments above, NR
represent the line number and -F
is the field separator.
add a comment |Â
up vote
0
down vote
awk
can do this job:
awk -F',' 'NR==2print $10' file
140
awk -F',' 'NR==3print $5' file
"14.23 ml"
awk -F',' 'NR==6print $10' file
1.524
If all the 500 files have the same format, meaning they share the same line number, then you can loop these commands over all the files.
In the comments above, NR
represent the line number and -F
is the field separator.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
awk
can do this job:
awk -F',' 'NR==2print $10' file
140
awk -F',' 'NR==3print $5' file
"14.23 ml"
awk -F',' 'NR==6print $10' file
1.524
If all the 500 files have the same format, meaning they share the same line number, then you can loop these commands over all the files.
In the comments above, NR
represent the line number and -F
is the field separator.
awk
can do this job:
awk -F',' 'NR==2print $10' file
140
awk -F',' 'NR==3print $5' file
"14.23 ml"
awk -F',' 'NR==6print $10' file
1.524
If all the 500 files have the same format, meaning they share the same line number, then you can loop these commands over all the files.
In the comments above, NR
represent the line number and -F
is the field separator.
edited 9 secs ago
answered 17 mins ago
Goro
9,41464589
9,41464589
add a comment |Â
add a comment |Â
Megan Wise is a new contributor. Be nice, and check out our Code of Conduct.
Megan Wise is a new contributor. Be nice, and check out our Code of Conduct.
Megan Wise is a new contributor. Be nice, and check out our Code of Conduct.
Megan Wise is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475689%2fextract-values-from-text-file-generated-from-excel-spreadsheets%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password