我有许多包含要转换为tex 的梵文文本的XML文件。Latex每个单词最多有 63 个字符才能进行连字符,所有超过此长度的字符都不会被连字符。现在我想为这些词grep我的文件,只是grep在这里似乎不是正确的工具。有些词使用IAST 编码,有些词使用Devan?gar?. 我想perl one-liner 可以做到吗?
对于 GNU sedv4.2.2-7,info sed说:
'/REGEXP/M'
'\%REGEXP%M'
The 'M' modifier to regular-expression matching is a GNU 'sed'
extension which directs GNU 'sed' to match the regular expression
in 'multi-line' mode. The modifier causes '^' and '$' to match
respectively (in addition to the normal behavior) the empty string
after a newline, and the empty string before a newline. There are
special character sequences ('\`' and '\'') which always match the
beginning or the end of the buffer. In …Run Code Online (Sandbox Code Playgroud) 我原以为这段代码会先打印“ oof ”:
echo foo | tee >(rev) | ( sleep 1 ; cat ; )
Run Code Online (Sandbox Code Playgroud)
输出:
foo
oof
Run Code Online (Sandbox Code Playgroud)
增加sleep时间不会改变顺序。为什么这不起作用?
请注意,其他工具确实按预期工作,例如: echo foo | pee rev 'sleep 1 ; cat'。
在bash v4.1.2(2) 上,以下简单的语句(仅用作演示问题的最小示例)给出了看似随机的输出:
$ for n in {0..1000}; do echo "$n"; done |
tee >(head -n2) >(sort -grk1,1 | head -n3) >/dev/null
Run Code Online (Sandbox Code Playgroud)
而以下给出了一致的输出:
$ seq 0 10000 | tee >(head -n2) >(sort -grk1,1 | head -n3) >/dev/null
Run Code Online (Sandbox Code Playgroud)
具体来说,对于第一条语句,该sort命令选择明显随机的连续三元组(例如,226,225,224;52,51,50;174,173,172;等等)。要了解输出的异质性,可以多次运行有问题的命令,然后列出不同可能性的数量:
$ seq -w 0 2000 | while read x; do for n in {0..1000}; do echo "$n"; done |
tee >(head -n2) >(sort -grk1,1 | head -n3) >/dev/null | cat > "file_${x}"; done
Run Code Online (Sandbox Code Playgroud)
计算各种输出的出现次数:
$ for f in …Run Code Online (Sandbox Code Playgroud) 我的鼠标没有硬件问题,我已经在我的其他系统上检查过了。
在我的 Debian v9.3 Gnome v3.22.2系统中,双击在File Manager、LibreOffice以及迄今为止我习惯的每个地方都不起作用。
当我双击文本时,它不会被选中。
当我双击文件夹时,文件夹不会打开。我必须右键单击一次,然后从列表中选择打开。
从一开始就不是这样,我已经遇到这个问题三天了。
我不记得手动更改任何特定设置。
如何重新启用双击?
我正在跑步,(据报道neofetch):
Debian GNU/Linux 9.3 (stretch)
x86_64 with Gnome 3.22.2 (desktop environment)
ThinkPad Edge E540
Kernel: 4.9.0-5-amd64
Packages: 2481
Shell: bash 4.4.12
DE: GNOME
WM: GNOME Shell
Theme: Adwaita [GTK2/3]
CPU: Intel i5-4300M (4) @ 3.3GHz
GPU: NVIDIA GeForce GT 740M
Memory: 3674MB
Run Code Online (Sandbox Code Playgroud) 我试图加入两个csv文件,排序,并使用制表符分隔符。
我是这个join命令的新手,所以我不太确定如何使用它,但它似乎用空格替换了文件中的每个选项卡(弄乱了对齐方式)。
我使用的命令是:
join -1 5 -2 2 -t $'\t' -o $order --header file1.csv file2.csv |
column -t > result.csv
Run Code Online (Sandbox Code Playgroud)
在第一个文件中,数据按照第5列和第二个文件中的第 2列进行排序。该变量$order是一个简单的字符串,包含不同的列'1.1 1.2 1.3'等(其中28个)。我使用的分隔符来自 SE。
你知道这是从哪里来的吗?
我想awk用来解析一个文件,并添加一行,当且仅当该行不存在时。
我的文件:
cccc
dddd
aaaa
mmm
Run Code Online (Sandbox Code Playgroud)
示例 1:我正在寻找“ aaaa ”
“aaaa”存在所以,没有任何反应,输出文件将是相同的。
示例 2:我正在寻找“ bbbb ”
“bbbb”不存在。我的输出文件应该是:
cccc
dddd
aaaa
mmm
bbbb
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到这个结果?
有没有办法使用shell脚本创建目标不存在的符号链接?
从阅读中man 1 ln,我看不到这样做的选项;甚至-f检查目标是否存在。
有没有办法实现我正在寻找的东西?
从源(2.4.23)构建apache2 http 服务器后,我没有和命令。a2dissitea2ensite
配置是:
./configure --with-included-apr --prefix=/usr/local/apache2
Run Code Online (Sandbox Code Playgroud)
当我运行时:
whereis apache2
我得到:
apache2: /etc/apache2 /usr/local/apache2
Run Code Online (Sandbox Code Playgroud)
但which apache2什么也没显示,也许需要对/usr/bin? http://localhost工作正常。
源版本信息:
/usr/local/apache2/bin/apachectl -v
Server version: Apache/2.4.23 (Unix)
Server built: Nov 1 2016 22:52:26
Linux版本:
linux mint 17
3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64
Run Code Online (Sandbox Code Playgroud) 这里我想写一些shell代码,我的问题是,我想将一个数据文件多次复制到另一个新文件中。例如: File1包含 3000 行数据。现在我想在另一个文件(File1 * 3 > File2)中多次使用这些数据。在这里,我将File1的数据复制3次并将其保存到File2。现在File2包含12000行数据。
谢谢。
在以下示例中:
apt-file search apache2.conf | grep -E "apache2.conf\b"
Run Code Online (Sandbox Code Playgroud)
输出:
apache2: /etc/apache2/apache2.conf
apache2-doc: /usr/share/doc/apache2-doc/examples/apache2/apache2.conf.gz
dicoweb: /etc/dicoweb/apache2.conf
emboss-explorer: /etc/apache2/conf-available/emboss-explorer.apache2.conf
emboss-explorer: /etc/emboss-explorer/apache2.conf
icinga-cgi: /usr/share/doc/icinga-cgi/examples/apache2.conf
icinga-cgi: /usr/share/icinga/apache2.conf
icinga2-classicui: /etc/icinga2-classicui/apache2.conf
kopano-webapp-apache2: /etc/apache2/conf-available/kopano-webapp-apache2.conf
kopano-webapp-apache2: /etc/kopano/webapp/apache2.conf
lacme: /etc/lacme/apache2.conf
lemonldap-ng-handler: /etc/apache2/sites-available/handler-apache2.conf
libjs-twitter-bootstrap: /usr/share/twitter-bootstrap/apache2.conf
liblemonldap-ng-manager-perl: /etc/apache2/sites-available/manager-apache2.conf
liblemonldap-ng-portal-perl: /etc/apache2/sites-available/portal-apache2.conf
mirmon: /usr/share/doc/mirmon/examples/mirror-apache2.conf
nagios3-cgi: /usr/share/nagios3-cgi/apache2.conf
oar-restful-api: /usr/share/oar/oar-api/apache2.conf
octopussy: /etc/octopussy/apache2.conf
spip: /usr/share/doc/spip/apache2.conf
Run Code Online (Sandbox Code Playgroud)
为什么不grep理解\bas 词边界并合并这一行:
apache2-doc: /usr/share/doc/apache2-doc/examples/apache2/apache2.conf.gz
Run Code Online (Sandbox Code Playgroud)
相同的结果具有和不具有的延伸(使用发生-E的)版本grep。
让我们看一个包含以下内容的示例文件,一个包含项目及其价格的费用报告:
$ cat file
Item1,200
Item2,500
Item345,900
Item20896,800
Item111,600
Run Code Online (Sandbox Code Playgroud)
现在,一位朋友向我提出挑战,要求我获取所有商品的总价——但不使用awk. 那可能吗?