sed -n 显示行号中使用变量的问题
来源:互联网 发布:视频点播php源码 编辑:程序博客网 时间:2024/05/01 10:03
sed -n 显示行号中使用变量的问题http://www.ajaxstu.com/Shellbiancheng/192339.html
cbs20
sed -n 显示行号中使用变量的问题
这样一个脚本 http://www.ajaxstu.com/Shellbiancheng/192339.html
ls ${path}20160911223*|sort | sed -n ''$t2','$(($t2+50))'p' | while read line
do
echo $line
`zcat $line |awk -F '|' '{if ($1~18637105120) print $0}' >> /home/unicomlabs/zhengzhoutime0.txt` &
done
这样一个脚本 http://www.ajaxstu.com/Shellbiancheng/192339.html
ls ${path}20160911223*|sort | sed -n ''$t2','$(($t2+50))'p' | while read line
do
echo $line
`zcat $line |awk -F '|' '{if ($1~18637105120) print $0}' >> /home/unicomlabs/zhengzhoutime0.txt` &
done
cat test.txt
123
234
345
542
adb
lsnd
我想打印每个文件除了最后两行的数据,脚本如下:
#!/bin/sh
line1=`wc -l test.txt`
line2=`expr $line1 - 2`
sed -n '1,$line2p' test.txt
因为test.txt大小会变,想通过一个变量实现,在sed 显示行号中无法使用变量
好像$line2p看成了一个变量了...
fox_fox
sed -n '1,'$line2'p' test.txt
这样应该就可以了
这样应该就可以了
r2007
$line2p---->${line2}p
置顶十三问里有说明
置顶十三问里有说明
cbs20
[quote]
sed -n '1,'$line2'p' test.txt
[/quote]
可以的,非常谢谢。
[quote]
$line2p---->${line2}p
[/quote]
好像不行
以下提示:
sed: -e expression #1, char 6: Extra characters after command
不好意思,以前看过十三问,没有仔细读 :)
sed -n '1,'$line2'p' test.txt
[/quote]
可以的,非常谢谢。
[quote]
$line2p---->${line2}p
[/quote]
好像不行
以下提示:
sed: -e expression #1, char 6: Extra characters after command
不好意思,以前看过十三问,没有仔细读 :)
waker
不行是你没看懂什么意思
sed -n 1,${line2}p test.txt
sed -n 1,${line2}p test.txt
cbs20
sed -n 1,${line2}p test.txt
sed -n '1,${line2}p' test.txt
我给加了引号了~
sed -n '1,${line2}p' test.txt
我给加了引号了~
0 0
- sed -n 显示行号中使用变量的问题
- sed中使用变量
- sed 中使用变量
- sed命令的样式中使用变量
- 在SED中使用变量
- sed替换中使用变量
- sed和awk中使用shell变量
- sed和awk中使用shell变量
- 如何在sed中使用变量
- 在sed命令中使用外部变量
- sed和awk中使用shell变量
- IDA 显示.o文件的行号问题
- Easyui Datagrid的Rownumber行号显示问题
- Easyui Datagrid的Rownumber行号显示问题
- 【转载】VC中显示行号的插件
- linux 中vi 显示行号的设置
- 在 Eclipse 中显示代码的行号
- Eclipse 中 显示代码的行号
- 基于MapboxGL的样式文件自动生成图例
- cocoapods 的安装以及安装中遇到的问题的解决方法-安装RVM
- 重新认识Activity(一)生命周期方法(系统垃圾回收机制和onSaveInstanceState)
- 利用Visual Basic操作XML数据
- 工银二维码,便捷支付中的黑马
- sed -n 显示行号中使用变量的问题
- 启动tomcat,出现BeanCreationException以及NUllPointerException
- ReactiveCocoa 导入工程以及简单使用
- BZOJ 1096 [ZJOI2007]仓库建设
- SlipHover – 动画遮罩层跟随鼠标移动
- 关于用juery来隐藏标签以及添加样式等
- PHP 字符串获取 substr 与 strstr 函数
- 分页
- For循环