Shrinking text in a file using bash [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
This question already has an answer here:
How can I wrap text at a certain column size?
6 answers
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 text-processing
New contributor
marked as duplicate by Ipor Sircer, Romeo Ninov, Jeff Schaller, RalfFriedl, Thomas Dickey 3 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
4
down vote
favorite
This question already has an answer here:
How can I wrap text at a certain column size?
6 answers
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 text-processing
New contributor
marked as duplicate by Ipor Sircer, Romeo Ninov, Jeff Schaller, RalfFriedl, Thomas Dickey 3 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
This question already has an answer here:
How can I wrap text at a certain column size?
6 answers
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 text-processing
New contributor
This question already has an answer here:
How can I wrap text at a certain column size?
6 answers
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
This question already has an answer here:
How can I wrap text at a certain column size?
6 answers
bash text-processing
bash text-processing
New contributor
New contributor
edited 3 hours ago
David Foerster
948616
948616
New contributor
asked 10 hours ago
ckameron
283
283
New contributor
New contributor
marked as duplicate by Ipor Sircer, Romeo Ninov, Jeff Schaller, RalfFriedl, Thomas Dickey 3 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Ipor Sircer, Romeo Ninov, Jeff Schaller, RalfFriedl, Thomas Dickey 3 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
12
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
3
And, if you want to actually break lines between words like normal text flow would be done, you can usefmt
instead offold
...
â twalberg
8 hours ago
add a comment |Â
up vote
3
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
12
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
3
And, if you want to actually break lines between words like normal text flow would be done, you can usefmt
instead offold
...
â twalberg
8 hours ago
add a comment |Â
up vote
12
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
3
And, if you want to actually break lines between words like normal text flow would be done, you can usefmt
instead offold
...
â twalberg
8 hours ago
add a comment |Â
up vote
12
down vote
accepted
up vote
12
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 10 hours ago
Goro
8,11153877
8,11153877
3
And, if you want to actually break lines between words like normal text flow would be done, you can usefmt
instead offold
...
â twalberg
8 hours ago
add a comment |Â
3
And, if you want to actually break lines between words like normal text flow would be done, you can usefmt
instead offold
...
â twalberg
8 hours ago
3
3
And, if you want to actually break lines between words like normal text flow would be done, you can use
fmt
instead of fold
...â twalberg
8 hours ago
And, if you want to actually break lines between words like normal text flow would be done, you can use
fmt
instead of fold
...â twalberg
8 hours ago
add a comment |Â
up vote
3
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
3
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
3
down vote
up vote
3
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 10 hours ago
mrc02_kr
916319
916319
add a comment |Â
add a comment |Â