我正在尝试在 sed 中做一些疯狂的正则表达式,但不允许这样做
我只是没有得到正则表达式还是 sed 中的正则表达式不同
我正在使用的文件就像
46,uie,ieo
39,ieu,tii
44-46,yut,til
45,dkd,ytu
65,dkd,ytu
40-45,dkd,ytu
Run Code Online (Sandbox Code Playgroud)
当我做
cat text.txt | sed s/^4[0-9],//g
Run Code Online (Sandbox Code Playgroud)
我几乎得到了我想要的,我得到了
uie,ieo
39,ieu,tii
44-46,yut,til
dkd,ytu
65,dkd,ytu
40-45,dkd,ytu
Run Code Online (Sandbox Code Playgroud)
但我想摆脱像 40-45 和 44-46 这样的所以我尝试过
cat text.txt | sed s/^4[0-9](-4[0-9])?,//g
-bash: syntax error near unexpected token `('
Run Code Online (Sandbox Code Playgroud)
当我尝试时
cat text.txt | sed s/^4[0-9]-?4?[0-9]?,//g
Run Code Online (Sandbox Code Playgroud)
我刚刚得到
46,uie,ieo
39,ieu,tii
44-46,yut,til
45,dkd,ytu
65,dkd,ytu
40-45,dkd,ytu
Run Code Online (Sandbox Code Playgroud)
所以什么都没有被过滤
谢谢你!
这是我正在使用的文件
word01.2 10 25
word01.2 30 50
word01.1 10 30
word01.1 40 50
word01.2 40 50
word01.1 10 20
word01.1 5 8
Run Code Online (Sandbox Code Playgroud)
当我尝试排序命令时
sort -k1,1 -k2,2 -k3,3 file.txt
Run Code Online (Sandbox Code Playgroud)
我收到以下信息;我不明白为什么第 2 行和第 1 行没有排序,它们应该处于相反的位置
word01.1 10 30
word01.1 10 20
word01.1 40 50
word01.1 5 8
word01.2 10 25
word01.2 30 50
word01.2 40 50
Run Code Online (Sandbox Code Playgroud)
当我尝试将 -g 添加到排序时,排序后的文件有更多问题并且第 1 列不再排序
sort -k1,1 -gk2,2 -gk3,3 file.txt
word01.1 5 8
word01.1 10 20
word01.2 10 25
word01.1 10 30
word01.2 30 50
word01.1 …Run Code Online (Sandbox Code Playgroud) 我正在关注有关如何设置 corba 的教程,但我无法使用他们谈论的软件包,而且互联网上的任何地方都无法充分说明如何获取它们。
我希望以下导入不会给我错误。
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
Run Code Online (Sandbox Code Playgroud)
下载JacORB只是给了我一个 github 文件,其中也有包“org.omg”的导入
有人说用这个 findjar 网站,我不知道那个网站上有什么东西
我想计算每行在文件中出现的次数
给出一列信息
cat woman and bain
bat man
hat woman
cat man
bat man and friends
fat man
hat woman
+bat man
cat woman and bain
super bat man
bat man
bat man
Run Code Online (Sandbox Code Playgroud)
我想收到类似的东西
2 cat woman and bain
3 bat man
2 hat woman
1 cat man
1 bat man and friends
1 fat man
1 +bat man
1 super bat man
Run Code Online (Sandbox Code Playgroud)
我有一些未完成的代码
open OUTFILE, '>text.txt';
while (<>){
if( text.txt =~ $_ ){
#increment the count for this occurence …Run Code Online (Sandbox Code Playgroud) 我想在我的bash脚本中缩进,以便我的脚本看起来更有条理,但不希望打印空格.
如果我有命令
printf "<image>
<<include etc/image.conf>>
</image>" > file.txt
Run Code Online (Sandbox Code Playgroud)
我希望file.txt看起来像
<image>
<<include etc/image.conf>>
</image>
Run Code Online (Sandbox Code Playgroud)
代替
<image>
<<include etc/image.conf>>
</image>
Run Code Online (Sandbox Code Playgroud)
问题是我不希望我的脚本看起来像这样
While Loop
If Statement
printf "<image>
<<include etc/image.conf>>
</image>" > file.txt
Command Here
End If
End While
Run Code Online (Sandbox Code Playgroud)
我只是想让它看起来有点整洁
我有一个输入标签,当我按下转义键时,我希望输入元素上的焦点消失,这意味着不再有文本光标或任何焦点样式(当用户输入时,他们的输入不会进入输入标签)。
下面的代码是我尝试实现上述功能的尝试,但它没有按预期工作。我想让这段代码按预期工作。
import React, { useRef } from 'react';
const onEscape = function (action) {
window && window.addEventListener('keydown', (e) => {
if (e.key === "Escape") {
action();
};
});
};
const MyComponent = () => {
...
const descRef = useRef();
onEscape(() => {
descRef.blur();
});
return (
<div>
<input
ref={descRef}
...
/>
</div>
);
};
Run Code Online (Sandbox Code Playgroud)
我已经测试了该onEscape函数,并且在将其他操作传递给它时它可以工作(当用户按下转义键时,它会执行传递给 onEscape 函数的任何函数)
My dropdowns look like the left on Chrome, but looks like the right on Firefox and Safari
How can I style my dropdown to look like the chrome version on safari and firefox? I don't like the grey background for the caret that shows on firefox (I would also like to move the caret symbol a little bit to the left)
This is my css and html for the dropdown. You can click "Run code snippet" on firefox and …
$ band1和$ band2两个被声明为(左边是$ band1,右边是$ band2)
s12 t12
s21 s11
t12 s12
t15 t23
t23 t15
Run Code Online (Sandbox Code Playgroud)
在我得到第一个印刷声明之后
s 12 t 12
s 21 s 11
t 12 s 12
t 15 t 23
t 23 t 15
Run Code Online (Sandbox Code Playgroud)
但似乎我的第二个if语句永远不会被执行(因为它应该是第二次通过.虽然我不知道为什么它没有执行但它看起来正确,它应该打印你好第二次,第三次和第四次确实它应该打印你好任何时间段和两个都是t和乐队1的数字高于乐队2或乐队1和2都是s和乐队2的数字高于乐队1的,或如果乐队在左边是的,右边的乐队是s.
my @splitB1 = split(//, "$band1");
my @splitB2 = split(//, "$band2");
my $band1Num = join("","$splitB1[1]","$splitB1[2]");
my $band2Num = join("","$splitB2[1]","$splitB2[2]");
print $splitB1[0], "\t", $band1Num, "\t", $splitB2[0], "\t", $band2Num, "\n";
if (($band1Num < $band2Num and $splitB1[0]=="s" and $splitB2[0]=="s"){
print "Hello World"
}
Run Code Online (Sandbox Code Playgroud)
谢谢