我有一个文件包含许多带变音符号的元音.我需要做这些替换:
我知道我可以一次更换一个:
sed -i 's/?/a/g' ./file.txt
Run Code Online (Sandbox Code Playgroud)
有没有更有效的方法来取代所有这些?
根据W3 Schools的这篇文章,可以在HTML中创建一个基本表,如下所示:
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
从上面看,似乎按行输入数据.
我有一种情况需要按列输入所有数据.这样的事情可能吗?
<table border="1">
<tc>
<td>row 1, cell 1</td>
<td>row 2, cell 1</td>
</tc>
<tc>
<td>row 1, cell 2</td>
<td>row 2, cell 2</td>
</tc>
</table>
Run Code Online (Sandbox Code Playgroud) 该sort
命令允许我按字母顺序放置行并删除重复的行.我需要类似的东西,可以在单行上排序,按顺序排列,并删除任何重复.有这个命令吗?
例如:
zebra ant spider spider ant zebra ant
Run Code Online (Sandbox Code Playgroud)
变更为:
ant spider zebra
Run Code Online (Sandbox Code Playgroud)
在第一个单词之前或最后一个单词之后没有空格.
我需要#
在包含模式"000"的任何行之前添加一个,例如,考虑这个示例文件:
This is a 000 line.
This is 000 yet ano000ther line.
This is still yet another line.
Run Code Online (Sandbox Code Playgroud)
如果我运行该命令,它应该添加#
到找到"000"的任何文件的前面.结果是这样的:
#This is a 000 line.
#This is 000 yet ano000ther line.
This is still yet another line.
Run Code Online (Sandbox Code Playgroud)
我能做的最好的是像这样的while循环,这似乎太复杂了:
while read -r line
do
if [[ $line == *000* ]]
then
echo "#"$line >> output.txt
else
echo $line >> output.txt
fi
done < file.txt
Run Code Online (Sandbox Code Playgroud)
如何#
在找到模式的任何行的前面添加一个?
如何重新排列文件中从最长到最短的所有行?例如:
elephant
zoo
penguin
Run Code Online (Sandbox Code Playgroud)
将改为
elephant
penguin
zoo
Run Code Online (Sandbox Code Playgroud) 我搜索了map cp
,但是找不到安静的选项,所以cp不会报告"没有这样的文件或目录".cp
如果尝试但未能复制文件,我怎么能不打印此错误?
我有这样一个文件:
This is a sentence.
This is another sentence.
Run Code Online (Sandbox Code Playgroud)
我需要在每个字符后面添加一个新行,这样每行只出现一个字符,例如:
T
h
i
s
i
s
a
s
e
n
t
e
n
c
e
.
T
h
i
s
i
s
a
n
o
t
h
e
r
s
e
n
t
e
n
c
e
.
Run Code Online (Sandbox Code Playgroud)
如何将每个字符删除到新行?
我在SoX中使用以下命令在每个静默时间超过0.3秒的地方分割许多大型音频文件:
sox -V3 input.wav output.wav silence 1 0.50 0.1% 1 0.3 0.1% : newfile : restart
Run Code Online (Sandbox Code Playgroud)
然而,这有时会在每次休息之前偶尔创建完全静音的文件并修剪音频.
我在Audacity中找到了更好的结果,但我需要分割数百个WAV文件,Audacity甚至无法同时打开10个文件而不会冻结.
如何在0.3秒的静音期结束时使用SoX或类似软件分割文件,这样静音部分仍然贴在说话结束时,但之前没有,并且没有完全静音的剪辑,除非他们从一开始就来input.wav
?
我有一个以页面为中心的段落,如下所示:
_________________________
| |
| Once upon a time, there |
| lived a squirrel who |
| lived in the middle of |
| the forest. |
|_________________________|
Run Code Online (Sandbox Code Playgroud)
我需要调整居中,使得特定标记的单词在页面上水平居中.在此示例中,单词"who"居中:
_________________________
| |
| Once upon |
| a time, there lived a |
| squirrel who lived in |
| the middle of the |
| forest. |
|_________________________|
Run Code Online (Sandbox Code Playgroud)
<div>
,即<center>Once upon a time, there lived a squirrel <div style="centered">who</div> lived in the middle of the forest.</center> …