How can I read each line in a file into: a vairable for the last field, and a variable for the other fields?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
How can I read ach line in a file into two variables: one for the last field, and the the other for the other fields ?
For example, I have a file:
hello world! 10s
It is a good day. 4m
...
I would like to read each line into two variables: the first one contains the message in the line, and the second variable contains the time interval at the end of the line. I was wondering how to do it?
while read line
do
... # split $line into $message and $interval
done < "$inputfile"
Thanks.
bash text-processing
add a comment |Â
up vote
0
down vote
favorite
How can I read ach line in a file into two variables: one for the last field, and the the other for the other fields ?
For example, I have a file:
hello world! 10s
It is a good day. 4m
...
I would like to read each line into two variables: the first one contains the message in the line, and the second variable contains the time interval at the end of the line. I was wondering how to do it?
while read line
do
... # split $line into $message and $interval
done < "$inputfile"
Thanks.
bash text-processing
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How can I read ach line in a file into two variables: one for the last field, and the the other for the other fields ?
For example, I have a file:
hello world! 10s
It is a good day. 4m
...
I would like to read each line into two variables: the first one contains the message in the line, and the second variable contains the time interval at the end of the line. I was wondering how to do it?
while read line
do
... # split $line into $message and $interval
done < "$inputfile"
Thanks.
bash text-processing
How can I read ach line in a file into two variables: one for the last field, and the the other for the other fields ?
For example, I have a file:
hello world! 10s
It is a good day. 4m
...
I would like to read each line into two variables: the first one contains the message in the line, and the second variable contains the time interval at the end of the line. I was wondering how to do it?
while read line
do
... # split $line into $message and $interval
done < "$inputfile"
Thanks.
bash text-processing
bash text-processing
asked 3 mins ago
Tim
24.7k70239429
24.7k70239429
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f480663%2fhow-can-i-read-each-line-in-a-file-into-a-vairable-for-the-last-field-and-a-va%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