求能实现两个功能的shell脚本,该怎么处理

WBOY
Release: 2016-06-13 13:50:00
Original
1035 people have browsed it

求能实现两个功能的shell脚本
发现用linux不懂shell就像打仗不会使枪一样。刚学。大家可以把自己认为常用的脚本粘出来。越初级的越好!我现在有二个需要解决
1 去了文件中的行号。大家在论坛发代码时有时会写上行号,如
1 2 echo "hello";
3 ?>
怎么把1,2,3给去了


2shell的配色方案
就是怎么修改.bashrc,让终端显示更加清晰

您只允许发表100分内的帖子。怎么还有这限制!!!不是我不想多加点分。CSDN不让。

------解决方案--------------------
试试这个(第一个)
sed 's/^[0-9]*\s//g' filename 



第二个不熟
------解决方案--------------------
你用什么编辑器? 文件行号一般是通过编辑器的属性设置取消和显示的。
------解决方案--------------------
回答第一个问题,test.txt为源文件,result.txt 经过处理后保存的文件名:

[wangyt@localhost scripts]$ cat test.txt 
1 2 echo "hello";
3 ?>
[wangyt@localhost scripts]$ cut -c3- test.txt > result.txt
[wangyt@localhost scripts]$ cat result.txt 
echo "hello";
?>
[wangyt@localhost scripts]$
------解决方案--------------------
二楼正解
To way830906 要是数字成了2位数 3位数 4位数 你那个还满足吗?

------解决方案--------------------
帮顶·~~~~~~~~~~````

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!