它在下面的列表中,我右键单击它然后将其删除
user2413's questions
好的,考虑这个示例文件:
#!/usr/bin/env bash
cat > example_file.txt <<EOL
group, , price
1, S_BRN_, 3.21
1, S_WBS_BRN_, 4.11
1, S_WBS_BRN, 1.22
2, S_BRN_WBS, 9.2
2, F_WBS_BRN_, 2.11
2, F_BRN_, 2.11
2, F_BRN_WBS_, 2.11
EOL
我想要所有包含字符串“F_BRN_”或“S_BRN_”的行。我执行以下 sed:
sed -n '/S_BRN_\|F_BRN_/p' example_file.txt
我得到:
1, S_BRN_, 3.21
1, S_WBS_BRN_, 4.11
2, S_BRN_WBS, 9.2
2, F_WBS_BRN_, 2.11
2, F_BRN_, 2.11
2, F_BRN_WBS_, 2.11
我的问题是:如何防止部分匹配?例如 F_WBS_BRN_ 不包含子字符串 F_BRN_,因此不应返回它。
我想计算所有子目录(和子子目录)中所有 .py 文件中的所有行。我尝试这样做:
find strats/ -type f | wc -l *.py
但同样,它只计算当前目录中 .py 文件中的行数,
cat -e file.txt
给出:
{"yellow":"mango"}^M$
^M$
{"yellow":"banana"}^M$
^M$
{"yellow":"blabla"}^M$
^M$
我只想拥有:
{""yellow":"mango"}^M$
{"yellow":"banana"}^M$
{"yellow":"blabla"}^M$
适用于文件夹中所有带有 txt 扩展名的文件。所以我尝试了:
find . -type f -name "*.txt" -print0 | xargs -0 sed -i "s/^M$^M$/^M$/g"
无济于事。有没有人有更好的主意?
head -n 3 file.txt | od -bc
产量:
0000000 173 042 171 145 154 154 157 167 042 072 042 155 141 156 147 157
{ " y e l l o w " : " m a n g o
0000020 042 175 015 012 015 012 173 042 142 141 142 141 142 042 072 042
" } \r \n \r \n { " b a b a b " : "
0000040 155 141 156 147 157 042 175 015 012
m a n g o " } \r \n
0000051
这个:
awk 1 RS='\r\n' ORS= < file.txt
完全删除新行(所以这不好:我想在每行上保留连续两行之一,但它会做一些事情)。
我在一个文件夹中有一堆pdf文件。我想给它们都加水印。watermak 应该是文件本身的名称。如何?
我正在使用 ubuntu 18.04LTS
考虑这个文件:
#!/usr/bin/env bash
cat > example_file.txt <<EOL
TITLE something
some data
some data
some data
TITLE something else
some other data
TITLE some more
some other data
some other data
some other data
TITLE extra info
some more data
some more data
EOL
我需要添加一个新列:
- 计算行数,
- 在发生 , 后返回
/^TITLE/
1 - 从文件的底部开始向上工作,
基本上,结果应该如下所示:
TITLE something,4
some data,3
some data,2
some data,1
TITLE something else,2
some other data,1
TITLE some more,4
some other data,3
some other data,2
some other data,1
TITLE extra info,3
some more data,2
some more data,1
PS你可以假设:
- 文件总是以匹配行开头
/^TITLE/
- 文件总是以不匹配的行结尾
/^TITLE/
- 没有连续的两行匹配
/^TITLE/
编辑:
到目前为止的结果
在一个 100MB 的文件上:
@亚罗姆
time tac trial.txt | awk 'BEGIN{x=0} {x++;{if ($1 !~/^pattern/) printf "%s,%s\n",$0,x;else if ($1 ~/^pattern/) {printf "%s,%s\n",$0,x;x=0}}}' | tac > trial2.txt
real 0m0,896s
@bac0n
time awk '{ a[i++]=$0 } END { while (i--) { a[i]=a[i] "," ++j; if (a[i] ~ /^pattern/) { j=0 } }; for (i=0; i<NR; i++) { print a[i] } }' trial.txt > trial2.txt
real 0m0,830s
@奥利夫:
time awk -v RS='^pattern' -v FS='\n' '
{
for(i=NF-1;i>0;i--)
printf "%s,%d\n",$i,i;
printf RT
}' trial.txt > trial2.txt
real 0m2,343s
@steeldriver
time awk -vRS='\n(^pattern|$)' -F'\n' -vOFS=, '
NR>1 {$1 = "^pattern" $1}
{for(i=1;i<=NF;i++) print $i, NF-i+1}
' trial.txt > trial2.txt
real 0m1,889s
使用 mawk 而不是 awk,我得到:
mawk: program limit exceeded: maximum number of fields size=32767
考虑这个文件:
#!/usr/bin/env bash
cat > example_file.txt <<EOL
|dms,wew,qwqw|
|m|head1|
|3,4,6|
|3e,2,23|
|m|head2|
|xw,12,2123|
|23,d,213|
|23,22q,2skl|
|m|head1|
|dljs,wqpw,2;a|
|dllw,w1p,1q;a|
EOL
每隔一段时间,就会有一个守卫模式:一行以:
|m|
(是的,文件的第一行不必是保护模式)现在我只想打印最后一个保护模式为的那些行:
|m|head1|
并忽略所有其他行。在其他最糟糕的情况下,我希望输出为:
#!/usr/bin/env bash
cat > desired_result_file.txt <<EOL
|m|head1|
|3,4,6|
|3e,2,23|
|m|head1|
|dljs,wqpw,2;a|
|dllw,w1p,1q;a|
EOL
#!/usr/bin/env bash
cat > example_file.txt <<EOL
group, , price
1, value, 3.21
1, 3.42, 4.11
1, 3.5, 1.22
2, 4.1, 9.2
2, 4.2, 2.11
EOL
我想将此文件的第 1 行第 2 列中的值替换为第 2 行第 2 列中的值。所以我希望 awk 返回这个:
#!/usr/bin/env bash
cat > example_file.txt <<EOL
group, value, price
1, value, 3.21
1, 3.42, 4.11
1, 3.5, 1.22
2, 4.1, 9.2
2, 4.2, 2.11
EOL
我找不到如何在 awk 中引用下一行:
cat example_file.txt | awk -F, 'BEGIN { OFS = FS } { if (NR==1) $2 = ??}'
考虑以下数据:
#!/usr/bin/env bash
cat > example_file.txt <<EOL
group, value, price
1, 3.21, 3.21
1, 3.42, 4.11
1, 3.5, 1.22
2, 4.1, 9.2
2, 4.2, 2.11
EOL
我想将“值”列移到前面:
value, price, group
3.21, 3.21, 1
3.42, 4.11, 1
3.5, 1.22, 1
4.1, 9.2, 2
4.2, 2.11, 2
问题是:列的顺序(甚至列的数量或许多列的名称——除了总是存在的“值”)因文件而异。所以我必须按名称(而不是顺序)选择值列。
我怎样才能做到这一点?
所以这是罪魁祸首:
zcat Merged.csv.gz | awk -F, 'FNR == 1 {header = $0; next} !seen[$7]++ {print header | "gzip > data/S20180528_"$7".txt.gz"} {print | "gzip > data/S20180528_"$7".txt.gz";}'
当我在这个大文件(Merged.csv.gz)上运行它时,我得到:
awk: cannot open "gzip > data/S20180528_2505329.txt.gz" for output (Too many open files)
我通过粘贴在此处和 stackoverflow 上找到的部分来创建原始命令。谷歌搜索,我想我可能弄乱了一些报价。现在,我不知道是哪一个。
考虑这个文件:
#!/usr/bin/env bash
cat > example_file.txt <<EOL
group, value
1, 3.21
1, 3.42
1, 3.5
2, 4.1
2, 4.2
EOL
现在我想将第二列第二行中的值设置为变量val2
。我尝试:
var='example_file.txt'
cat $var | val2=$(awk -F, "NR==2{print $2; exit}")
但
- 这不起作用:
echo "$val2"
什么都不返回 val2
如果文件只有一行,我想分配一个默认值。
考虑这个文件:
#!/usr/bin/env bash
cat > example_file.txt <<EOL
group, value
1, 3.21
1, 3.42
1, 3.5
2, 4.1
2, 4.2
EOL
在下面的脚本中,我按第一列中的值对该文件的行进行分组(第一列中的值已经排序)并将每个组打印到一个单独的 txt 文件中:
var=$(echo 'example_file.txt')
var2=$(echo $var|sed "s/.txt//g")
mkdir -p output
cat $var | awk -v varn="$var2" -F, 'FNR == 1 {header = $0;next} !seen[$1]++ { print header > ("output/"varn"_"$1".txt") }{print > ("output/"varn"_"$1".txt");}'
问题
如何将结果打印到压缩流"output/"varn"_"$1".gz"
(而不是未压缩的 txt 文件"output/"varn"_"$1".txt"
)?
(因此所需的输出与现在生成的脚本相同,只是我希望将输出的文件压缩并保存到.txt.gz
而不是像现在的代码那样的纯文本文件)。
(我尝试gzip >
在{print}
块内使用但无济于事:(
(PS 我是一个 awk 菜鸟,所以这个问题可能是一个非常愚蠢的问题。)
好的,我在一个文件夹中有很多文件,它们的名称中有字符串“ $varname .txt”`:
for file in find output/ -name "*$varname*.txt" -type f; do echo $file; done
...
现在这些文件都有两行和 9 列。我想将第 2 行第 9 列的内容添加到他们的 filname 的末尾(就在 之前.txt
)。
所以我知道如何打印所有这些文件的 in cell(2, 9) 的值:
find output/ -name "*$varname*.txt" -type f -exec awk -F' ' 'NR==2{print $9}' {} \;
我挣扎的是如何将该字符串作为这些文件名中扩展名之前的最后一件事
我有一个压缩文件Data.zip
(如果未压缩)包含许多文件:
file_1.txt
file_2.txt
...
...
我想要一个 CLI 命令将其转换为一个新文件夹Data_zipped
,其中包含Data.zip
未压缩的单个文件:
Data_zipped/file_1.zip
Data_zipped/file_2.zip
...
...
但诀窍在于它Data.zip
包含如此多的文件(而且它们总体上是如此之大),以至于我无法先解压缩 Data.zip,然后一口气压缩其中的各个文件:这一切都必须“即时”发生:
对于所有文件Data.zip/
- 获取第 i 个文件
- 把它压缩成
name_of_that_file.zip
- 将压缩文件存储在新文件夹中
Data_zipped
如何使用 CLI 做到这一点?
我修改了@George 的超清晰脚本,以帮助更好地解释文件夹结构:
#!/bin/bash
#Name of zip file
filename=$1
# Check if valid zip file is passed
if [[ $(file "$filename" | grep -o "Zip archive data") =~ "Zip archive data" ]]
then
# List the contents of the zip file
unzip -l "$filename"
# Get the number of files in zip file
count=$(unzip -l "$filename" | awk '{count = $2 - 2} END {print count}')
echo "$count"
fi
exit 0
当我运行它时,我得到(我使用一个只有几个文件的令牌 Data.zip,但你明白了):
./GU_script.sh Data.zip
Archive: Data.zip
Length Date Time Name
--------- ---------- ----- ----
0 2017-11-21 22:58 Data/
120166309 2017-11-21 14:58 Data/Level1_file.csv
120887829 2017-11-21 14:58 Data/Level1_other_file.csv
163772796 2017-11-21 14:59 Data/Level1_yet_other_file.csv
193519556 2017-11-21 14:59 Data/Level1_here_is_another_file.csv
153798779 2017-11-21 14:59 Data/Level1_so_many_files.csv
131918225 2017-11-21 14:59 Data/Level1_many_more_to_go.csv
--------- -------
884063494 7 files
5
所以基本上,我希望将Level1_file.csv
其他文件单独压缩(-> Level1_file.zip)并放在一个文件夹中。
编辑2;
我最终结合了@George 和@David Foerster 的答案:
#!/bin/bash
#Name of zip file
filename="$1"
# Check if valid zip file is passed
if file "$filename" | grep -wq "Zip archive data";
then
#!/bin/bash
src="$filename"
dst=.
LC_ALL=C unzip -l "$src" |
sed -re '1,/^-{6}/d; /^-{6}/,$d; /\/$/d; s/^\s*(\S+\s+){3}//' |
while IFS= read -r f; do
out="${f##*/}"; out="$dst/${f%%/*}_zipped/${out%.*}.zip"
if [ ! -d "${out%/*}" ]; then
mkdir -p "${out%/*}" || break
fi
zip --copy "$src" --out "$out" "$f" || break
done
else
echo "Invalid file type: \"zip\" file required"
exit 1
fi
当我启动 Spyder3 或 backintime 时,它们现在在统一启动器中短暂闪烁,但从未真正出现。
(见图)。如何解决这个问题?他们俩以前都像一周前一样工作。
编辑:
当然,这里有两个:
~$ backintime
Traceback (most recent call last):
File "/usr/share/backintime/common/backintime.py", line 23, in <module>
import config
File "/usr/share/backintime/common/config.py", line 31, in <module>
import tools
File "/usr/share/backintime/common/tools.py", line 43, in <module>
import dbus
File "/usr/lib/python3/dist-packages/dbus/__init__.py", line 81, in <module>
import dbus.exceptions as exceptions
AttributeError: module 'dbus' has no attribute 'exceptions'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/share/backintime/common/backintime.py", line 23, in <module>
import config
File "/usr/share/backintime/common/config.py", line 31, in <module>
import tools
File "/usr/share/backintime/common/tools.py", line 43, in <module>
import dbus
File "/usr/lib/python3/dist-packages/dbus/__init__.py", line 81, in <module>
import dbus.exceptions as exceptions
AttributeError: module 'dbus' has no attribute 'exceptions'
和
~$ spyder3
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 150, in lock
symlink(str(os.getpid()), self.name)
FileExistsError: [Errno 17] File exists: '6240' -> '/home/me/.config/spyder-py3/spyder.lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 177, in lock
kill(int(pid), 0)
ProcessLookupError: [Errno 3] No such process
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/app/start.py", line 118, in main
lock_created = lock.lock()
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 196, in lock
rmlink(self.name)
PermissionError: [Errno 13] Permission denied: '/home/me/.config/spyder-py3/spyder.lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/qtpy/__init__.py", line 148, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/spyder3", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/spyder/app/start.py", line 138, in main
from spyder.app import mainwindow
File "/usr/local/lib/python3.6/dist-packages/spyder/app/mainwindow.py", line 49, in <module>
requirements.check_qt()
File "/usr/local/lib/python3.6/dist-packages/spyder/requirements.py", line 39, in check_qt
import qtpy
File "/usr/local/lib/python3.6/dist-packages/qtpy/__init__.py", line 154, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 150, in lock
symlink(str(os.getpid()), self.name)
FileExistsError: [Errno 17] File exists: '6240' -> '/home/me/.config/spyder-py3/spyder.lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 177, in lock
kill(int(pid), 0)
ProcessLookupError: [Errno 3] No such process
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/app/start.py", line 118, in main
lock_created = lock.lock()
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 196, in lock
rmlink(self.name)
PermissionError: [Errno 13] Permission denied: '/home/me/.config/spyder-py3/spyder.lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/qtpy/__init__.py", line 148, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/spyder3", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/spyder/app/start.py", line 138, in main
from spyder.app import mainwindow
File "/usr/local/lib/python3.6/dist-packages/spyder/app/mainwindow.py", line 49, in <module>
requirements.check_qt()
File "/usr/local/lib/python3.6/dist-packages/spyder/requirements.py", line 39, in check_qt
import qtpy
File "/usr/local/lib/python3.6/dist-packages/qtpy/__init__.py", line 154, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
(我已尝试按照此处的说明进行操作。我无法使用 Anaconda)
sudo apt-get install spyder3
安装 150MB 的好东西。然后,我这样做:
pip install -U spyder
然后我做
spyder3
我得到:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 150, in lock
symlink(str(os.getpid()), self.name)
FileExistsError: [Errno 17] File exists: '4809' -> '/home/me/.config/spyder-py3/spyder.lock'## Heading ##
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 177, in lock
kill(int(pid), 0)
ProcessLookupError: [Errno 3] No such process
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/app/start.py", line 118, in main
lock_created = lock.lock()
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 196, in lock
rmlink(self.name)
PermissionError: [Errno 13] Permission denied: '/home/me/.config/spyder-py3/spyder.lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/qtpy/__init__.py", line 148, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/spyder3", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/spyder/app/start.py", line 138, in main
from spyder.app import mainwindow
File "/usr/local/lib/python3.6/dist-packages/spyder/app/mainwindow.py", line 49, in <module>
requirements.check_qt()
File "/usr/local/lib/python3.6/dist-packages/spyder/requirements.py", line 39, in check_qt
import qtpy
File "/usr/local/lib/python3.6/dist-packages/qtpy/__init__.py", line 154, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 150, in lock
symlink(str(os.getpid()), self.name)
FileExistsError: [Errno 17] File exists: '4809' -> '/home/me/.config/spyder-py3/spyder.lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 177, in lock
kill(int(pid), 0)
ProcessLookupError: [Errno 3] No such process
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/spyder/app/start.py", line 118, in main
lock_created = lock.lock()
File "/usr/local/lib/python3.6/dist-packages/spyder/utils/external/lockfile.py", line 196, in lock
rmlink(self.name)
PermissionError: [Errno 13] Permission denied: '/home/me/.config/spyder-py3/spyder.lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/qtpy/__init__.py", line 148, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/spyder3", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/spyder/app/start.py", line 138, in main
from spyder.app import mainwindow
File "/usr/local/lib/python3.6/dist-packages/spyder/app/mainwindow.py", line 49, in <module>
requirements.check_qt()
File "/usr/local/lib/python3.6/dist-packages/spyder/requirements.py", line 39, in check_qt
import qtpy
File "/usr/local/lib/python3.6/dist-packages/qtpy/__init__.py", line 154, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
可以Rsymphony
通过以下方式安装:
apt-get install r-cran-rsymphony
但那是一个旧版本。当尝试安装最新的(从内部R
)时,一个得到:
* installing *source* package ‘Rsymphony’ ...
** package ‘Rsymphony’ successfully unpacked and MD5 sums checked
Cannot find SYMPHONY libraries and headers.
See <https://projects.coin-or.org/SYMPHONY>.
ERROR: configuration failed for package ‘Rsymphony’
如何安装最新的 Rsymphony 软件包?
我填写了此答案中的详细信息。但是当我尝试连接时,我得到:
VPN Connection Failed '...because the VPN service stopped'
跑步
tail -f /var/log/syslog
给了我这个:
Mar 9 21:34:20 me NetworkManager[6063]: ** Message: pppd started with pid 8330
Mar 9 21:34:20 me NetworkManager[6063]: <info> [1489091660.9205] vpn-connection[0x1e067e0,54552dfa-6db2-4050-8b47-fd108b79f201,"VPN connection 1",0]: VPN plugin: state changed: starting (3)
Mar 9 21:34:20 me pppd[8330]: Plugin /usr/lib/pppd/2.4.7/nm-pptp-pppd-plugin.so loaded.
Mar 9 21:34:20 me NetworkManager[6063]: Plugin /usr/lib/pppd/2.4.7/nm-pptp-pppd-plugin.so loaded.
Mar 9 21:34:20 me NetworkManager[6063]: ** Message: nm-pptp-ppp-plugin: (plugin_init): initializing
Mar 9 21:34:20 me pppd[8330]: pppd 2.4.7 started by root, uid 0
Mar 9 21:34:20 me NetworkManager[6063]: ** Message: nm-pptp-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
Mar 9 21:34:20 me pppd[8330]: Using interface ppp0
Mar 9 21:34:20 me NetworkManager[6063]: Using interface ppp0
Mar 9 21:34:20 me NetworkManager[6063]: Connect: ppp0 <--> /dev/pts/19
Mar 9 21:34:20 me NetworkManager[6063]: ** Message: nm-pptp-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
Mar 9 21:34:20 me NetworkManager[6063]: nm_device_get_device_type: assertion 'NM_IS_DEVICE (self)' failed
Mar 9 21:34:20 me pppd[8330]: Connect: ppp0 <--> /dev/pts/19
Mar 9 21:34:20 me NetworkManager[6063]: <info> [1489091660.9369] manager: (ppp0): new Generic device (/org/freedesktop/NetworkManager/Devices/6)
Mar 9 21:34:20 me pptp[8335]: nm-pptp-service-8312 log[main:pptp.c:350]: The synchronous pptp option is NOT activated
Mar 9 21:34:20 me NetworkManager[6063]: <info> [1489091660.9505] devices added (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
Mar 9 21:34:20 me NetworkManager[6063]: <info> [1489091660.9506] device added (path: /sys/devices/virtual/net/ppp0, iface: ppp0): no ifupdown configuration found.
Mar 9 21:34:20 me pptp[8347]: nm-pptp-service-8312 log[ctrlp_rep:pptp_ctrl.c:259]: Sent control packet type is 1 'Start-Control-Connection-Request'
Mar 9 21:34:20 me pptp[8347]: nm-pptp-service-8312 log[ctrlp_disp:pptp_ctrl.c:781]: Received Start Control Connection Reply
Mar 9 21:34:20 me pptp[8347]: nm-pptp-service-8312 log[ctrlp_disp:pptp_ctrl.c:815]: Client connection established.
Mar 9 21:34:21 me pptp[8347]: nm-pptp-service-8312 log[ctrlp_rep:pptp_ctrl.c:259]: Sent control packet type is 7 'Outgoing-Call-Request'
Mar 9 21:34:21 me pptp[8347]: nm-pptp-service-8312 log[ctrlp_disp:pptp_ctrl.c:900]: Received Outgoing Call Reply.
Mar 9 21:34:21 me pptp[8347]: nm-pptp-service-8312 log[ctrlp_disp:pptp_ctrl.c:939]: Outgoing call established (call ID 34527, peer's call ID 32815).
Mar 9 21:34:51 me pppd[8330]: LCP: timeout sending Config-Requests
Mar 9 21:34:51 me NetworkManager[6063]: LCP: timeout sending Config-Requests
Mar 9 21:34:51 me NetworkManager[6063]: ** Message: nm-pptp-ppp-plugin: (nm_phasechange): status 11 / phase 'disconnect'
Mar 9 21:34:51 me NetworkManager[6063]: Connection terminated.
Mar 9 21:34:51 me pppd[8330]: Connection terminated.
Mar 9 21:34:51 me NetworkManager[6063]: ** Message: Terminated ppp daemon with PID 8330.
Mar 9 21:34:51 me NetworkManager[6063]: <warn> [1489091691.9659] vpn-connection[0x1e067e0,54552dfa-6db2-4050-8b47-fd108b79f201,"VPN connection 1",0]: VPN plugin: failed: connect-failed (1)
Mar 9 21:34:51 me NetworkManager[6063]: <info> [1489091691.9661] vpn-connection[0x1e067e0,54552dfa-6db2-4050-8b47-fd108b79f201,"VPN connection 1",0]: VPN plugin: state changed: stopping (5)
Mar 9 21:34:51 me NetworkManager[6063]: <error> [1489091691.9681] platform-linux: do-change-link[13]: failure changing link: failure 19 (No such device)
Mar 9 21:34:51 me NetworkManager[6063]: <warn> [1489091691.9682] device (ppp0): failed to disable userspace IPv6LL address handling
Mar 9 21:34:51 me NetworkManager[6063]: <info> [1489091691.9693] vpn-connection[0x1e067e0,54552dfa-6db2-4050-8b47-fd108b79f201,"VPN connection 1",0]: VPN plugin: state changed: stopped (6)
Mar 9 21:34:51 me NetworkManager[6063]: <info> [1489091691.9710] vpn-connection[0x1e067e0,54552dfa-6db2-4050-8b47-fd108b79f201,"VPN connection 1",0]: VPN plugin: state change reason: unknown (0)
Mar 9 21:34:51 me NetworkManager[6063]: <info> [1489091691.9719] vpn-connection[0x1e067e0,54552dfa-6db2-4050-8b47-fd108b79f201,"VPN connection 1",0]: VPN service disappeared
Mar 9 21:34:51 me NetworkManager[6063]: <info> [1489091691.9727] devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
Mar 9 21:34:51 me NetworkManager[6063]: ** Message: nm-pptp-ppp-plugin: (nm_phasechange): status 1 / phase 'dead'
Mar 9 21:34:51 me NetworkManager[6063]: Terminating on signal 15
Mar 9 21:34:51 me NetworkManager[6063]: Child process /usr/sbin/pptp 217.145.41.15 --nolaunchpppd --loglevel 0 --logstring nm-pptp-service-8312 (pid 8333) terminated with signal 15
Mar 9 21:34:51 me NetworkManager[6063]: Modem hangup
Mar 9 21:34:51 me NetworkManager[6063]: ** Message: nm-pptp-ppp-plugin: (nm_exit_notify): cleaning up
Mar 9 21:34:51 me pptp[8335]: nm-pptp-service-8312 warn[decaps_hdlc:pptp_gre.c:220]: short read (-1): Input/output error
Mar 9 21:34:51 me pptp[8335]: nm-pptp-service-8312 warn[decaps_hdlc:pptp_gre.c:232]: pppd may have shutdown, see pppd log
Mar 9 21:34:51 me pppd[8330]: Terminating on signal 15
Mar 9 21:34:51 me pppd[8330]: Child process /usr/sbin/pptp 217.145.41.15 --nolaunchpppd --loglevel 0 --logstring nm-pptp-service-8312 (pid 8333) terminated with signal 15
Mar 9 21:34:51 me pppd[8330]: Modem hangup
Mar 9 21:34:51 me pptp[8347]: nm-pptp-service-8312 log[callmgr_main:pptp_callmgr.c:245]: Closing connection (unhandled)
Mar 9 21:34:51 me pptp[8347]: nm-pptp-service-8312 log[ctrlp_rep:pptp_ctrl.c:259]: Sent control packet type is 12 'Call-Clear-Request'
Mar 9 21:34:51 me pptp[8347]: nm-pptp-service-8312 log[call_callback:pptp_callmgr.c:84]: Closing connection (call state)
Mar 9 21:34:51 me pppd[8330]: Exit.