绳子看起来像是(北纬37°35‘11.2“,北纬85°30’40.3”)
grep不工作
grep -a "(37\°35\'11\.2\" N 85\°30\'40\.3\"W)" file.txt
grep "(37\°35\'11\.2\" N 85\°30\'40\.3\"W)" file.txt
grep -a "(37°35'11.2\" N 85°30'40.3\"W)" file.txt
人们..。我正在编写linux文件,我需要它对文本'Josh''1234进行grep。有没有办法忽略这些撇号?以下是我尝试过的:(乔什被设置为usr,1234被设置为pas)。
if grep -q '\'$usr\'\'$pas\''; then
echo username and password correct
else
echo INCORECT
sleep 10
fi
下面是一个名为“.bashrc”的文件的快照:
我是bash的初学者,在bash中我要做的是检查文件中的最后两行是否存在并正确编写,例如:
if [ export PATH=/opt/ads2/arm-linux64/bin:$PATH ]
then
echo "found system variable lines"
else
echo "systemvariables do not exists, please insert it in .bashrc"
fi
但是,这似乎并不简单,因为要共享的两行不是纯字符串行。
提前感谢
我在linux (redhat)文件系统上有一堆php文件,大多数文件看起来还不错,因为它们使用抽象数据库交互的函数,但是我发现有些地方使用内联查询而不是抽象层函数。
这些查询似乎被设计为与mysql一起运行,但我们运行的是Oracle,因此它们在检查空值时会产生故障,例如:
select name from user where name !=''
在Oracle中,此查询永远不会返回任何行,我需要将其更改为:
select name from user where name !=' '
我已经能够在我浏览的文件中修复此问题,现在我想主动查找其他文件中出现此
如果我将cat命令保存到字符串中,然后执行它,那么我将得到一个错误。
linux# cmd="cat /data/test/test.tx* | grep toto"
linux# eval '$cmd'
cat: |: No such file or directory
cat: grep: No such file or directory
cat: toto: No such file or directory
即使是
linux# $cmd
cat: |: No such file or directory
cat: grep: No such file
为什么这个命令行工作:
$ output='Irrelevant'; if [[ $output =~ Something ]]; then echo "I found something in the output." ; fi
这个给了我一个奇怪的解析错误?
$ output='Irrelevant'; if [[ $output =~ Something ]]; then echo "I found something in the output!" ; fi
-bash: !": event not found
与
你好,我是linux、grep和awk命令的新手。
我试图从这个字符串变量中获取数字值,然后将其存储在另一个变量中。
var1="Version must be incremented on update. Current version is: 532"
var2=var1 | grep "?"
我应该怎么做才能从上面的字符串中检索val 532并将其存储在var2中
我是Linux新手,到目前为止,我一直在使用一些实用程序,特别是grep实用程序。我决定创建一个新文件(恰如其分地称为“newfile”),其内容如下:
Lady of the night,
I hold you close to me,
And everything is out of sight,
I think I'll be alright.
当我试图通过输入“grep .*新文件”在grep中运行它时,我只期望显示文件的行;但是,它打印了几个结果,开头是:
grep: ..: Is a directory
接下来是完整的.bash_history (为了保持这个帖子的简短,我
我的数据:
KVM05786Y: The Communication host "ADMK05786HTREDIRECT_JA3A" is SUCESS
KVM05786Y: The Communication host "KOPYUTRCEPORT_JA3A" is SUCESS
KVM05786Y: The Communication host "ADMK05786HTSRM_JA3A" is SUCESS
KVM05786Y: The Communication host "ADMK05786HTIAS_JA3A" is S