黑松山资源网 Design By www.paidiu.com
本文实例讲述了Linux bash删除文件中含“指定内容”的行功能。分享给大家供大家参考,具体如下:
#!/bin/sh # 功能: 删除文件中含"指定内容"的行 # 运行方式: ./dline.sh c.log ==> 产生输出文件: c.log0 array=( "rm -f lvr_3531_pf_new" "arm-hisiv100-linux-gcc " "In function " "excess elements in array initializer" "warning: multi-line comment" "embedded '\\0' in format" "__NR_SYSCALL_BASE" "this is the location of the previous definition" "dereferencing type-punned pointer will break strict-aliasing rules" "differ in signedness" "but argument is of type" "implicit declaration of" ) if [ $# -lt 1 ]; then echo "Usage: $0 <logfile>" exit fi file="$1"0 cp -f $1 $file function deleteLine() { sed "/$1/d" $file > tmp mv -f tmp $file } wc -l $file for line in "${array[@]}" do if [ ${#line} -gt 0 ] && [ ${line:0:1} != "#" ]; then deleteLine "$line" fi done wc -l $file
运行情况:
[feng@bash #69]$./dline.sh c.log 556 c.log0 63 c.log0 [feng@bash #70]$
希望本文所述对大家bash shell学习有所帮助。
黑松山资源网 Design By www.paidiu.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
黑松山资源网 Design By www.paidiu.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
2024年10月10日
2024年10月10日
- 马小倩《落花A2HD3-HQCD》头版限量[低速原抓WAV+CUE]
- 343前动画师怒喷343糟糕管理层:纯纯的毒瘤
- 《生化2RE》12.31苹果Mac平台发售:现已登陆商店
- 《使命召唤21:黑色行动6》实机发售预告!体验史诗电影单人战役
- 《张雨生 不朽的歌声 黑胶2CD》[WAV/分轨][860MB]
- 《赵传 你过得还好吗 2017》[FLAC/分轨][350MB]
- 《流行新歌告诉你 36首经典金曲 2CD》[WAV+CUE][1GB]
- 王宏伟.2012-用我的心握你的手【太平洋影音】【WAV+CUE】
- 谢安琪.2006-K.SUS.2(EP)(2015金碟复刻版)【BanBanMusic】【WAV+CUE】
- 谢安琪.2005-KAY.ONE(2015金碟复刻版)【BanBanMusic】【WAV+CUE】
- 《勇敢小骑士》评测:是永无乡,亦是梦幻岛
- 《哈利波特:魁地奇锦标赛》:我们魔法学院自己的足球赛
- 《冰汽时代2》评测:看来这一切都是值得的
- 《蛋仔派对》翻糖壳壳皮肤图鉴
- 《蛋仔派对》斑马乐乐皮肤图鉴