How to add a text file content to the next column of an existing table

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
As a Linux Command Line beginner, I have a pretty basic question.
How do a add a new line to an existing .txt file, that consists of a text string, a tab, and a value of another text file?
Precisely, I have a text file test1.txt that looks like this:
A B
and a test2.txt file that only contains the number value 100.
What I want to do is to use a command by which I would edit the test1.txt file, and make it look like this:
A B
C 100
I've tried using the following command:
echo -e "C t" test2.txt>>test1.txt.
I know that by using the command
test2.txt>>test1.txt
I will add a new row to test1.txt, with the value of 100, but what I'm trying to do is to add that value as a next column as I wish to make a table with data.
linux command-line table
add a comment |Â
up vote
0
down vote
favorite
As a Linux Command Line beginner, I have a pretty basic question.
How do a add a new line to an existing .txt file, that consists of a text string, a tab, and a value of another text file?
Precisely, I have a text file test1.txt that looks like this:
A B
and a test2.txt file that only contains the number value 100.
What I want to do is to use a command by which I would edit the test1.txt file, and make it look like this:
A B
C 100
I've tried using the following command:
echo -e "C t" test2.txt>>test1.txt.
I know that by using the command
test2.txt>>test1.txt
I will add a new row to test1.txt, with the value of 100, but what I'm trying to do is to add that value as a next column as I wish to make a table with data.
linux command-line table
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
As a Linux Command Line beginner, I have a pretty basic question.
How do a add a new line to an existing .txt file, that consists of a text string, a tab, and a value of another text file?
Precisely, I have a text file test1.txt that looks like this:
A B
and a test2.txt file that only contains the number value 100.
What I want to do is to use a command by which I would edit the test1.txt file, and make it look like this:
A B
C 100
I've tried using the following command:
echo -e "C t" test2.txt>>test1.txt.
I know that by using the command
test2.txt>>test1.txt
I will add a new row to test1.txt, with the value of 100, but what I'm trying to do is to add that value as a next column as I wish to make a table with data.
linux command-line table
As a Linux Command Line beginner, I have a pretty basic question.
How do a add a new line to an existing .txt file, that consists of a text string, a tab, and a value of another text file?
Precisely, I have a text file test1.txt that looks like this:
A B
and a test2.txt file that only contains the number value 100.
What I want to do is to use a command by which I would edit the test1.txt file, and make it look like this:
A B
C 100
I've tried using the following command:
echo -e "C t" test2.txt>>test1.txt.
I know that by using the command
test2.txt>>test1.txt
I will add a new row to test1.txt, with the value of 100, but what I'm trying to do is to add that value as a next column as I wish to make a table with data.
linux command-line table
asked Mar 25 at 11:38
Ljubo
1
1
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
printf %s $'Ct'; cat test2.txt; >>test1.txt
or
( printf %s $'Ct'; cat test2.txt ) >>test1.txt
or
printf %s $'Ct' >>test1.txt
cat test2.txt >>test1.txt
or in bash
printf %s $'Ct'"$(<test2.txt)"; >>test1.txt
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
printf %s $'Ct'; cat test2.txt; >>test1.txt
or
( printf %s $'Ct'; cat test2.txt ) >>test1.txt
or
printf %s $'Ct' >>test1.txt
cat test2.txt >>test1.txt
or in bash
printf %s $'Ct'"$(<test2.txt)"; >>test1.txt
add a comment |Â
up vote
0
down vote
printf %s $'Ct'; cat test2.txt; >>test1.txt
or
( printf %s $'Ct'; cat test2.txt ) >>test1.txt
or
printf %s $'Ct' >>test1.txt
cat test2.txt >>test1.txt
or in bash
printf %s $'Ct'"$(<test2.txt)"; >>test1.txt
add a comment |Â
up vote
0
down vote
up vote
0
down vote
printf %s $'Ct'; cat test2.txt; >>test1.txt
or
( printf %s $'Ct'; cat test2.txt ) >>test1.txt
or
printf %s $'Ct' >>test1.txt
cat test2.txt >>test1.txt
or in bash
printf %s $'Ct'"$(<test2.txt)"; >>test1.txt
printf %s $'Ct'; cat test2.txt; >>test1.txt
or
( printf %s $'Ct'; cat test2.txt ) >>test1.txt
or
printf %s $'Ct' >>test1.txt
cat test2.txt >>test1.txt
or in bash
printf %s $'Ct'"$(<test2.txt)"; >>test1.txt
answered Mar 25 at 11:45
Hauke Laging
53.3k1282130
53.3k1282130
add a comment |Â
add a comment |Â
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%2f433403%2fhow-to-add-a-text-file-content-to-the-next-column-of-an-existing-table%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