小编she*_*ter的帖子

gnuplot histogram:第0行:使用规范时列太多

我想创建一个包含以下内容的文件的直方图:

1 144 12.54
2 564 02.34
3 231 01.23
4 452 07.12
Run Code Online (Sandbox Code Playgroud)

我在脚本中用于此目的的是:

gnuplot << EOF
            set terminal gif
            set terminal postscript eps color enhanced
            set output "diagramma";
            set title 'Diagramma'
            set key off
            set style data histogram
            set style histogram cluster gap 1
            set style fill solid border -1
            set boxwidth 0.9
            set autoscale
            set xlabel "May"
            plot 'finalsumfile' using 1:2 with histogram, 'finalsumfile' using 1:3 with histogram

EOF
Run Code Online (Sandbox Code Playgroud)

所以我希望第一列为x坐标,第二列为第三列.

但是,当我运行我的脚本时出现此错误:

line 0: Too many columns in using …
Run Code Online (Sandbox Code Playgroud)

bash plot gnuplot histogram

3
推荐指数
1
解决办法
6045
查看次数

从双引号bash脚本中包含的字符串中删除空格

我一直在使用sep来尝试这个,基本上我有一个文本文件,其中包含相同数量的相同行,例如

4444 username "some information" "someotherinformation" "even more information"
Run Code Online (Sandbox Code Playgroud)

我需要用下划线替换引号内的空格,所以它看起来像这样

4444 username "some_information" "someotherinformation" "even_more_information"
Run Code Online (Sandbox Code Playgroud)

目前我已经能够分离出引用的信息

sed 's/"\([^"]*\)"/_/g' myfile.txt
Run Code Online (Sandbox Code Playgroud)

关于如何进行的建议?

unix string bash awk

3
推荐指数
1
解决办法
1781
查看次数

如何在Powershell中解析csv中列的字符串

我有一个csv配置如下:

PK,INV_AMT,DATE,INV_NAME,NOTE
1,123.44,634,asdfljk,TEST 12OING 06/01/2010 DATE: 04/10/2012
2,123.44,634,wet aaa,HI HOW ARE YOU 11.11 DATE: 01/01/2011
3,123.44,634,dfssdsdfRR,LOOK AT ME NOW….HI7&&& DATE: 06/11/1997
4,123.44,634,asdfsdgg,LOOK AT ME NOW….HI7&&& DATE: 03-21-2097
5,123.44,634,45746345,LOOK AT ME NOW….HI7&&& DATE: 02/18/2000
Run Code Online (Sandbox Code Playgroud)

如何DATE使用powershell在注释列中的字符串" :" 之后解析日期?

例如,第一行在TEST 12OING 06/01/2010 DATE: 04/10/2012注释列中包含字符串" ".我需要解析' 04/10/2012那一行.

我希望能够从上面的csv文件中读取并解析该日期并将其添加为csv文件中的新列.

谢谢你的帮助.

csv powershell parsing substring

3
推荐指数
1
解决办法
1万
查看次数

在Bash中,如何删除目录中文件名中的所有数字,同时保持文件扩展名不变

我在这样的目录中有文件:

asdfs54345gsdf.pdf
gsdf6456wer.pdf
oirt4534724wefd.pdf
Run Code Online (Sandbox Code Playgroud)

我想将所有文件重命名为数字+ .pdf,以便上述文件重命名为:

54345.pdf
6456.pdf
4534724.pdf
Run Code Online (Sandbox Code Playgroud)

最好的是本机Bash命令或脚本(OSX 10.6.8)

我收到的一些线索包括

sed 's/[^0-9]*//g' input.txt 
sed 's/[^0-9]*//g' input.txt > output.txt 
sed -i 's/[^0-9]*//g' input.txt 
echo ${A//[0-9]/} rename 's/[0-9] //' *.pdf 
Run Code Online (Sandbox Code Playgroud)

macos bash

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

在oracle上创建空间索引

我有一个表'floating_options',我想在列'area_geo'上创建一个空间索引(这是一个sdo_geometry列,当我从floating_options中选择*时,有两行数据按预期显示).

我使用了以下代码,但我收到以下错误.我会非常感谢任何帮助!谢谢!

CREATE INDEX area_idx ON floating_options(area_geo)
   INDEXTYPE IS MDSYS.SPATIAL_INDEX;


Error report -
SQL Error: ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-13203: failed to read USER_SDO_GEOM_METADATA view
ORA-13203: failed to read USER_SDO_GEOM_METADATA view
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
29855. 00000 -  "error occurred in the execution of ODCIINDEXCREATE routine"
*Cause:    Failed to successfully execute the ODCIIndexCreate routine.
*Action:   Check to see if the routine has been coded correctly.
Run Code Online (Sandbox Code Playgroud)

sql oracle geospatial spatial-index

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

运行 nohup 而不发送消息

嗨,我有一个 bash 脚本并运行这样的过程

nohup $proces &
Run Code Online (Sandbox Code Playgroud)

当我这样做时,scipt 会发送类似的按摩

nohup: appending.. 
Run Code Online (Sandbox Code Playgroud)

有没有办法防止按摩输出?或者是否有替代命令执行相同的操作并且没有发送按摩?

linux bash

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

用空格替换双引号

这可能是这里讨论最多的话题之一.我尝试了几乎所有这里发现的命令和其他调整,但似乎并没有做得好.

我想用whitespace/blank替换我文件中的所有双引号

我试图执行此命令时看到以下错误.

sed "s/"/ \''/g' x_orbit.txt > new.tx
sed: -e expression #1, char 3: unterminated `s' command
Run Code Online (Sandbox Code Playgroud)

unix shell awk grep sed

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

使用sed复制匹配模式的行

我一直试图在论坛中寻找某个命令一段时间没有找到解决方案所以我希望你能够帮助我.我想做的事情很简单.我想使用see复制与模式匹配的行.例如,如果我有一个看起来像这样的文件:

abc
def
cda
abd
Run Code Online (Sandbox Code Playgroud)

我想复制包含'ab'的每一行,即:

abc
abc
def
cda
abd
abd
Run Code Online (Sandbox Code Playgroud)

我尝试了以下语法:

sed '/ab/a\&' myfile
Run Code Online (Sandbox Code Playgroud)

因为我在某处看过字符"&"代表匹配的模式,但我得到的是:

abc
&def
cda
abd
&
Run Code Online (Sandbox Code Playgroud)

有什么我想念的吗?我猜有.

非常感谢您的帮助.

仅供参考,我正在使用mac OS X.

sed

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

使用sed输出中的特定文件列表在linux上创建tar gz

这是我的命令行:

find . -type f -exec file {} \; \
| sed 's/\(.*png\): .* \([0-9]* x [0-9]*\).*/\2 \1/' \
| sed 's/\(.*jpg\): .* \([0-9]*x[0-9]*\).*/\2 \1/' \
| awk 'int($1) < 1000' \
| sed 's/^.*[[:blank:]]//' \
| tar -czvf images.tar.gz --null -T -
Run Code Online (Sandbox Code Playgroud)

而我得到的错误是:

tar:Unix \n./test.png \n./test2.jpg \n:无法统计:没有这样的文件或目录
tar:由于先前的错误而退出失败状态

我想要的是找到当前目录中的所有图像,其宽度小于1000像素并将它们焦化到存档中.

unix linux bash sed tar

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

标签 统计

bash ×5

sed ×3

unix ×3

awk ×2

linux ×2

csv ×1

geospatial ×1

gnuplot ×1

grep ×1

histogram ×1

macos ×1

oracle ×1

parsing ×1

plot ×1

powershell ×1

shell ×1

spatial-index ×1

sql ×1

string ×1

substring ×1

tar ×1