我试图根据第四列对此文件进行排序.我希望文件根据第四列的值重新排序.
文件:
2   1:103496792:A   0   103496792
3   1:103544434:A   0   103544434
4   1:103548497:A   0   103548497
1   1:10363487:T    0   10363487
我希望它像这样排序:
1   1:10363487:T    0   10363487
2   1:103496792:A   0   103496792
3   1:103544434:A   0   103544434
4   1:103548497:A   0   103548497
我试过这个命令:
sort -t$'\t' -k1,1 -k2,2 -k3,3 -k 4,4 <filename>
但我得到非法变量名称错误.有人可以帮我这个吗?
我正在尝试使用简单的命令将hello world写入文件:
50 complexity:test% python2.7
Python 2.7.3 (default, Feb 11 2013, 12:48:32)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f=open("/export/home/vignesh/resres.txt","w")
>>> f.write("hello world")
>>> f.write("\t".join(["hello","world"]))
这将返回一个空文件.
我想编写一个bash脚本,它将获取用户输入并将其存储在一个数组中.输入:1 4 6 9 11 17 22
我希望将其保存为数组.
我正在尝试获取 bash 脚本的输入参数。testbash.sh 4 1 2 4 5 Science ap * 我想将这些参数作为数组获取,我使用 $@ 将其全部获取到数组中。现在,根据第一个参数,我需要对其余参数进行子集化。这里第一个数字是 4,所以从第二个参数到第五个参数应该保存为一个数组,如 [1 2 4 5] ,其余参数保存在另一个数组中。
我试过这个
array=( $@ )
 len=${#array[@]}
 args=${array[@]:0:$len-${array[1]}}
 echo $args
我尝试这样做来获取第一部分,但当我运行此“testbash.sh 4 1 2 4 5 Science ap * ”时,我在表达式中遇到错误语法错误(错误标记为“:-4”)
我找不到命令错误.0和$ filestem是两个args,我在脚本中有以下内容.当我执行脚本时,我找不到命令.
echo -e "Enter the file stem name"
read filestem
python gen_par_final.py 0 $filestem
输入文件,python脚本和bash脚本都在同一个文件夹中.python脚本在命令promt中工作,但不在脚本内部.是否有任何路径可以设置或解决问题?
我有一个列表
 
[1,2,3,4,5,6,7,8]
 
我想在python中将其转换为[[1,2,3,4] [5,6,7,8]].有人可以帮我这个
运行if else语句时,我不断收到意外的文件结尾错误
#! /bin/bash
echo -e "1: Proband\n 2: mincount\n Enter an option:"
read promin
echo $promin
if ($promin == 1) then
echo -e "Enter the proband file name\n"
read proband_file
echo "$proband_file"
endif
if ($promin == 2) then
echo -e "enter the min count number\n"
read mincount
echo "$mincount mincount"
endif
我也尝试了fi而不是elseif。但是我仍然遇到同样的错误。有人可以帮我解决这个问题吗?
我得到了这个意外的"完成"令牌错误
echo -e "Enter the file stem name"
read filestem
for i in {1..22}
do
    `java -cp /export/home/alun/jpsgcs/ CMorgansToTheta $filestem_$i.INPUT.par $filestem_$i.THETA.par`
done
我有一个文件,所有行都以制表符空格字符结尾.我想只删除最后一个制表符空格字符.我怎么做??
例如:
"a   b   c   0 0   0 0   0 0   0 0   "
我想要它 
"a   b   c   0 0   0 0   0 0   0 0"
bash ×6
linux ×6
shell ×6
python ×4
arrays ×1
end-of-life ×1
file ×1
file-io ×1
if-statement ×1
python-2.7 ×1
sorting ×1