小编Din*_*ngo的帖子

在上一行的句号之后将一行的第一个字母大写

我有很多小诗要编辑,如下所示:

\n
Io avevo due sorelle,\nuna bionda e l\xe2\x80\x99altra mora,\ntutte e due leggiadre e belle\ne gentil come l\xe2\x80\x99aurora.\nma la bionda mi \xc3\xa8 sparita,\nse ne \xc3\xa8 andata all\xe2\x80\x99altra vita.\nmi hanno detto che lass\xc3\xb9\npi\xc3\xb9 risplende il suo bel viso\ndove \xc3\xa8 gioia ed \xc3\xa8 sorriso\nma non torner\xc3\xa0 mai pi\xc3\xb9.\ne la mora sta lontana,\nnella terra pascoliana.\ncolgo e bacio il primo fiore:\nil pensier quel bacio porta\nsu la viva e su la morta,\ntutte e due lo stesso amore.\n
Run Code Online (Sandbox Code Playgroud)\n

意大利语语法规则规定,当一节经文在前一节经文中有一个句号之后开始时,第一个字母要大写。应该是这样(例如,请参见第 5 行句点后的大写字母)

\n
Io avevo due …
Run Code Online (Sandbox Code Playgroud)

sed text-processing text text-formatting

7
推荐指数
4
解决办法
1019
查看次数

在 for 循环中每对字符串重复两次

我需要传递给 pdftk,一个由重复两次的字符串构成的参数列表,例如:

A1-2 B1-2 A3-4 B3-4 A5-6 B5-6... 等等...

我设法通过此解决方法实现了这一目标

for ((x=1, y=2;x>=18, y<=18;x++, y++)); do echo "A$x-$y B$x-$y "; done| awk 'NR %2==1 {print $1, $2} ' | tr '\n' ' '
Run Code Online (Sandbox Code Playgroud)

这给出了:

A1-2 B1-2 A3-4 B3-4 A5-6 B5-6 A7-8 B7-8 A9-10 B9-10 A11-12 B11-12 A13-14 B13-14 A15-16 B15-16 A17- 18 B17-18

但我不满意,我正在寻找一种合适、更优雅、更好的方式来执行这项任务

bash numbering

2
推荐指数
2
解决办法
428
查看次数

遵循给定规则缩进文本行

我想知道如何按照自定义规则递归地缩进越来越多的诗行。例如

假设我们有:

OF Mans First Disobedience, and the Fruit
Of that Forbidden Tree, whose mortal tast
Brought Death into the World, and all our woe,
With loss of Eden, till one greater Man
Restore us, and regain the blissful Seat,
Sing Heav'nly Muse, that on the secret top
Of Oreb, or of Sinai, didst inspire
That Shepherd, who first taught the chosen Seed,
In the Beginning how the Heav'ns and Earth
Rose out of Chaos: Or if Sion Hill
Delight …
Run Code Online (Sandbox Code Playgroud)

text-processing text text-formatting

2
推荐指数
1
解决办法
206
查看次数

标签 统计

text ×2

text-formatting ×2

text-processing ×2

bash ×1

numbering ×1

sed ×1