Shrinking text in a file using bash
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I have text file look like this:
If you are a software developer in your 20s or 30s, you've grown up in a world dominated by Linux. It has been a significant player in the data center for decades, and while it's hard to find definitive operating system market share reports, Linux's share of data center operating systems could be as high as 70%, with Windows variants carrying nearly all the remaining percentage. Developers using any major public cloud can expect the target system will run Linux. Evidence that Linux is everywhere has grown in recent years when you add in Android and Linux-based embedded systems in smartphones, TVs, automobiles, and many other devices.
i want to shrink it so it look like this
If you are a software developer in your 20s or 30s,
you've grown up in a world dominated by Linux. It ha
s been a significant player in the data center for d
ecades, and while it's hard to find definitive opera
ting system market share reports, Linux's share of d
ata center operating systems could be as high as 70%
, with Windows variants carrying nearly all the rema
ining percentage. Developers using any major public
cloud can expect the target system will run Linux. E
vidence that Linux is everywhere has grown in recent
years when you add in Android and Linux-based embed
ded systems in smartphones, TVs, automobiles, and ma
ny other devices.
and then enlarge it so it look like this:
If you are a software developer in your 20s or 30s, you've grown up in a world dominated by Linux. It has been a significant player in the data center for decades, and while it's hard to find definiti
ve operating system market share reports, Linux's share of data center operating systems could be as high as 70%, with Windows variants carrying nearly all the remaining percentage. Developers using a
ny major public cloud can expect the target system will run Linux. Evidence that Linux is everywhere has grown in recent years when you add in Android and Linux-based embedded systems in smartphones,
TVs, automobiles, and many other devices.
how can I do that, i need to include that in my script
bash
New contributor
add a comment |Â
up vote
2
down vote
favorite
I have text file look like this:
If you are a software developer in your 20s or 30s, you've grown up in a world dominated by Linux. It has been a significant player in the data center for decades, and while it's hard to find definitive operating system market share reports, Linux's share of data center operating systems could be as high as 70%, with Windows variants carrying nearly all the remaining percentage. Developers using any major public cloud can expect the target system will run Linux. Evidence that Linux is everywhere has grown in recent years when you add in Android and Linux-based embedded systems in smartphones, TVs, automobiles, and many other devices.
i want to shrink it so it look like this
If you are a software developer in your 20s or 30s,
you've grown up in a world dominated by Linux. It ha
s been a significant player in the data center for d
ecades, and while it's hard to find definitive opera
ting system market share reports, Linux's share of d
ata center operating systems could be as high as 70%
, with Windows variants carrying nearly all the rema
ining percentage. Developers using any major public
cloud can expect the target system will run Linux. E
vidence that Linux is everywhere has grown in recent
years when you add in Android and Linux-based embed
ded systems in smartphones, TVs, automobiles, and ma
ny other devices.
and then enlarge it so it look like this:
If you are a software developer in your 20s or 30s, you've grown up in a world dominated by Linux. It has been a significant player in the data center for decades, and while it's hard to find definiti
ve operating system market share reports, Linux's share of data center operating systems could be as high as 70%, with Windows variants carrying nearly all the remaining percentage. Developers using a
ny major public cloud can expect the target system will run Linux. Evidence that Linux is everywhere has grown in recent years when you add in Android and Linux-based embedded systems in smartphones,
TVs, automobiles, and many other devices.
how can I do that, i need to include that in my script
bash
New contributor
1
Possible duplicate of How can I wrap text at a certain column size?
â Ipor Sircer
41 mins ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have text file look like this:
If you are a software developer in your 20s or 30s, you've grown up in a world dominated by Linux. It has been a significant player in the data center for decades, and while it's hard to find definitive operating system market share reports, Linux's share of data center operating systems could be as high as 70%, with Windows variants carrying nearly all the remaining percentage. Developers using any major public cloud can expect the target system will run Linux. Evidence that Linux is everywhere has grown in recent years when you add in Android and Linux-based embedded systems in smartphones, TVs, automobiles, and many other devices.
i want to shrink it so it look like this
If you are a software developer in your 20s or 30s,
you've grown up in a world dominated by Linux. It ha
s been a significant player in the data center for d
ecades, and while it's hard to find definitive opera
ting system market share reports, Linux's share of d
ata center operating systems could be as high as 70%
, with Windows variants carrying nearly all the rema
ining percentage. Developers using any major public
cloud can expect the target system will run Linux. E
vidence that Linux is everywhere has grown in recent
years when you add in Android and Linux-based embed
ded systems in smartphones, TVs, automobiles, and ma
ny other devices.
and then enlarge it so it look like this:
If you are a software developer in your 20s or 30s, you've grown up in a world dominated by Linux. It has been a significant player in the data center for decades, and while it's hard to find definiti
ve operating system market share reports, Linux's share of data center operating systems could be as high as 70%, with Windows variants carrying nearly all the remaining percentage. Developers using a
ny major public cloud can expect the target system will run Linux. Evidence that Linux is everywhere has grown in recent years when you add in Android and Linux-based embedded systems in smartphones,
TVs, automobiles, and many other devices.
how can I do that, i need to include that in my script
bash
New contributor
I have text file look like this:
If you are a software developer in your 20s or 30s, you've grown up in a world dominated by Linux. It has been a significant player in the data center for decades, and while it's hard to find definitive operating system market share reports, Linux's share of data center operating systems could be as high as 70%, with Windows variants carrying nearly all the remaining percentage. Developers using any major public cloud can expect the target system will run Linux. Evidence that Linux is everywhere has grown in recent years when you add in Android and Linux-based embedded systems in smartphones, TVs, automobiles, and many other devices.
i want to shrink it so it look like this
If you are a software developer in your 20s or 30s,
you've grown up in a world dominated by Linux. It ha
s been a significant player in the data center for d
ecades, and while it's hard to find definitive opera
ting system market share reports, Linux's share of d
ata center operating systems could be as high as 70%
, with Windows variants carrying nearly all the rema
ining percentage. Developers using any major public
cloud can expect the target system will run Linux. E
vidence that Linux is everywhere has grown in recent
years when you add in Android and Linux-based embed
ded systems in smartphones, TVs, automobiles, and ma
ny other devices.
and then enlarge it so it look like this:
If you are a software developer in your 20s or 30s, you've grown up in a world dominated by Linux. It has been a significant player in the data center for decades, and while it's hard to find definiti
ve operating system market share reports, Linux's share of data center operating systems could be as high as 70%, with Windows variants carrying nearly all the remaining percentage. Developers using a
ny major public cloud can expect the target system will run Linux. Evidence that Linux is everywhere has grown in recent years when you add in Android and Linux-based embedded systems in smartphones,
TVs, automobiles, and many other devices.
how can I do that, i need to include that in my script
bash
bash
New contributor
New contributor
edited 3 mins ago
Rui F Ribeiro
37k1273117
37k1273117
New contributor
asked 49 mins ago
ckameron
183
183
New contributor
New contributor
1
Possible duplicate of How can I wrap text at a certain column size?
â Ipor Sircer
41 mins ago
add a comment |Â
1
Possible duplicate of How can I wrap text at a certain column size?
â Ipor Sircer
41 mins ago
1
1
Possible duplicate of How can I wrap text at a certain column size?
â Ipor Sircer
41 mins ago
Possible duplicate of How can I wrap text at a certain column size?
â Ipor Sircer
41 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
accepted
You can use the command fold as follows:
fold -w
The flag w
in the command fold can control the text (shrink vs extend) depending on the number of the included columns.
In your example:
fold -w 52 file
and
fold -w 200 file
add a comment |Â
up vote
1
down vote
You can use this command:
sed 's/.80/&n/g' file
Where 80
is number of characters you want to have in one line and file
is file where you store your text.
.80
- regexp which match exactly 80 characters
&n
- append n
to matched text
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
You can use the command fold as follows:
fold -w
The flag w
in the command fold can control the text (shrink vs extend) depending on the number of the included columns.
In your example:
fold -w 52 file
and
fold -w 200 file
add a comment |Â
up vote
5
down vote
accepted
You can use the command fold as follows:
fold -w
The flag w
in the command fold can control the text (shrink vs extend) depending on the number of the included columns.
In your example:
fold -w 52 file
and
fold -w 200 file
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
You can use the command fold as follows:
fold -w
The flag w
in the command fold can control the text (shrink vs extend) depending on the number of the included columns.
In your example:
fold -w 52 file
and
fold -w 200 file
You can use the command fold as follows:
fold -w
The flag w
in the command fold can control the text (shrink vs extend) depending on the number of the included columns.
In your example:
fold -w 52 file
and
fold -w 200 file
answered 45 mins ago
Goro
7,86553472
7,86553472
add a comment |Â
add a comment |Â
up vote
1
down vote
You can use this command:
sed 's/.80/&n/g' file
Where 80
is number of characters you want to have in one line and file
is file where you store your text.
.80
- regexp which match exactly 80 characters
&n
- append n
to matched text
add a comment |Â
up vote
1
down vote
You can use this command:
sed 's/.80/&n/g' file
Where 80
is number of characters you want to have in one line and file
is file where you store your text.
.80
- regexp which match exactly 80 characters
&n
- append n
to matched text
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You can use this command:
sed 's/.80/&n/g' file
Where 80
is number of characters you want to have in one line and file
is file where you store your text.
.80
- regexp which match exactly 80 characters
&n
- append n
to matched text
You can use this command:
sed 's/.80/&n/g' file
Where 80
is number of characters you want to have in one line and file
is file where you store your text.
.80
- regexp which match exactly 80 characters
&n
- append n
to matched text
answered 38 mins ago
mrc02_kr
887319
887319
add a comment |Â
add a comment |Â
ckameron is a new contributor. Be nice, and check out our Code of Conduct.
ckameron is a new contributor. Be nice, and check out our Code of Conduct.
ckameron is a new contributor. Be nice, and check out our Code of Conduct.
ckameron 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%2f474261%2fshrinking-text-in-a-file-using-bash%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
1
Possible duplicate of How can I wrap text at a certain column size?
â Ipor Sircer
41 mins ago