cat

Linux基础(一)

流过昼夜 提交于 2019-11-27 20:36:15
目录 1.1linux基础 1.1.1 描述计算机的组成及其功能 1.1.2 冯诺依曼型计算机的基本原理 1.1.3 冯诺依曼体系三个特点 1.1.4 服务器 1.1.5 操作系统 1.16 Linux的发行版 1.17 Linux的哲学思想 1.18 vmware虚拟机的下载与安装 1.19 linux笔记总结(一) Linux基础(一) 1.1linux基础 1.1.1 描述计算机的组成及其功能 计算机是由运算器、控制器、存储器、输入设备、输出设备组成 运算器:执行各种计算和逻辑运算操作 控制器:完成协调和指挥整个计算机系统的操作 储存器:暂时存储或者长期存储数据 输入设备:向计算机输入数据和信息的设备 输出设备:计算机硬件系统的终端设备 1.1.2 冯诺依曼型计算机的基本原理 计算机由运算器、控制器、存储器、输入设备和输出设备五大部件组成。 数据和程序以二进制代码形式存放在存储器中,存放的位置由地址确定。 控制器根据存放在存储器中的指令序列(程序)进行工作,并由一个计数器控制指令的执行,控制器具有判断能力,能以数据结构为基础,选择不同的工作流程。 冯・诺依曼型计算机的基本原理的核心思想是“存储程序与程序控制”。 1.1.3 冯诺依曼体系三个特点 (1)计算机应包括运算器、存储器、控制器、输入和输出设备五大基本部件。 (2)计算机内部应采用二进制来表示指令和数据

观察者

為{幸葍}努か 提交于 2019-11-27 20:12:02
public delegate void CatCall(); public class Cat : subject { public void cry() { Console.WriteLine("猫叫了~"); this.fireAway(); } } public class subject { public event CatCall myEnvet; protected void fireAway() { if (this.myEnvet != null) { this.myEnvet(); } } } public abstract class Observer { public Observer(subject sub) { sub.myEnvet += new CatCall(Response); } public abstract void Response(); } public class Mouse : Observer { private string MouseName; public Mouse(subject sub, string name) : base(sub) { this.MouseName = name; } public override void Response() { Console.WriteLine(MouseName +

linux-12基本命令之 cat,more,head, tail ,tr,od,wc,cut,diff

爱⌒轻易说出口 提交于 2019-11-27 19:26:56
1、cat 命令 用于查看纯文本文件(较短),格式:"cat[选项][文件]" 查看文本文件 [root@localhost /]# cat 文件名 cat 参数 参数 作用 -n 显示行号 -b 显示行号(不包括空格) -A 显示出不可见的符号,如 空格,tab建 2、more 命令 用于查看纯文本文件(较长的)格式:"more[选项] 文件"   查看文本文件 [root@localhost etc]# more 文件名 more 参数 参数 作用 -数字 预先显示的行数 (默认为一页) -d 显示提示语句与报错信息 3、head 命令用于查看文本的前N行 查看文本前20行 head -n 10 文件名 head 命令 参数 作用 -n 10 显示10行 -n -10 正常输出但不显示最后的10行    4、tail 查看纯文本的文档的后N行 格式为:"tail [选项][文件]" 查看文本文件的后20行: [root@localhost etc]# tail -n 20 文件名 tail 参数 参数 作用 -n 10 显示后面10行 -f 持续刷新显示的内容 5、tr 命令用于转换文本文件中的字符,格式为:"tr[原始字符][目标字符]" [root@localhost etc]# cat tr.tex |tr[a-z][A-Z] 6、od 命令用于对查看特殊格式的文件

设计模式之里氏转换原则

穿精又带淫゛_ 提交于 2019-11-27 18:03:24
c#里氏转换原则 1、定义 子类型必须能替换掉他们的父类型。 简单例子:一个是鸟类,一个是企鹅类,鸟可以飞,但是企鹅不能飞,那么企鹅类就不能继承自鸟类(即使现实世界企鹅是鸟类),因为企鹅并非拥有鸟类所有的非Private的行为和属性。 2、实例 //动物父类 public class Animal { public virtual void Eat () { Console.WriteLine( "动物吃" ); } public virtual void Run () { Console.WriteLine( "动物跑" ); } } //子类 public class Cat:Animal { public override void Eat () { Console.WriteLine( "小猫吃" ); } } 客户端代码: static void Main( string [] args) { //子类可以替换父类 Animal al = new Cat(); Cat cat = (Cat)al; Animal al1 = new Animal(); //父类不能替换子类,会报错 Cat cat1 = (Cat)al1; al.Eat(); cat.Eat(); Console.ReadKey(); } Animal al1 = new Animal(); Cat

Linux 查看日志文件

杀马特。学长 韩版系。学妹 提交于 2019-11-27 15:33:23
1. tail命令:从文本文件的尾部开始查看,用于显示文本文件的末尾几行 tail -n filename  指定需要显示多少行 tail -f filename   实时 显示文件内容, 默认最后10行,相当于增加参数 -n 10 tail -n 50 -f filename   实时 显示文件的后50行内容 2. 搜索关键字附近的日志 最常用的: cat -n filename |grep "关键字" 其他情况: cat filename | grep -C 5 '关键字' (显示日志里匹配字串那行以及前后5行) cat filename | grep -B 5 '关键字' (显示匹配字串及前5行) cat filename | grep -A 5 '关键字' (显示匹配字串及后5行) 来源: https://www.cnblogs.com/nemowang1996/p/11368532.html

Preserving leading white space while reading>>writing a file line by line in bash

孤街浪徒 提交于 2019-11-27 15:14:51
I am trying to loop through a directory of text files and combine them into one document. This works great, but the text files contain code snippets, and all of my formatting is getting collapsed to the left. All leading whitespace on a line is stripped. #!/bin/sh OUTPUT="../best_practices.textile" FILES="../best-practices/*.textile" for f in "$FILES" do echo "Processing $f file..." echo "">$OUTPUT cat $f | while read line; do echo "$line">>$OUTPUT done echo >>$OUTPUT echo >>$OUTPUT done I am admittedly a bash noob, but after searching high and low I couldn't find a proper solution. Apparently

爬虫day1

别来无恙 提交于 2019-11-27 13:47:58
一、urllib import urllib.request response= urllib.request.urlopen("") html=response.read() print(html) utf-8解码 html = html.decode("utf-8") print(html) 二、实战一 下载一只猫 import urllib.request response = urllib.request.urlopen('http://placekitten.com/g/600/700') #=req=urllib.request.Request('http://placekitten.com/g/600/700') #response=urllib.request.urlopen(req) cat_img = response.read() with open('cat_600_700.jpg','wb')as f: f.write(cat_img) 三个查询函数. geturl() info() getcode() >>> response.geturl() 'http://placekitten.com/g/600/700' >>> response.info() <http.client.HTTPMessage object at

PHP之Trait详解

僤鯓⒐⒋嵵緔 提交于 2019-11-27 13:23:12
php从以前到现在一直都是单继承的语言,无法同时从两个基类中继承属性和方法,为了解决这个问题,php出了Trait这个特性 用法:通过在类中使用use 关键字,声明要组合的Trait名称,具体的Trait的声明使用Trait关键词,Trait不能实例化 如下代码实例: <?php trait Dog{ public $name="dog"; public function bark(){ echo "This is dog"; } } class Animal{ public function eat(){ echo "This is animal eat"; } } class Cat extends Animal{ use Dog; public function drive(){ echo "This is cat drive"; } } $cat = new Cat(); $cat->drive(); echo "<br/>"; $cat->eat(); echo "<br/>"; $cat->bark(); ?> 将会如下输出 This is cat drive This is animal eat This is dog 再测试Trait、基类和本类对同名属性或方法的处理,如下代码 <?php trait Dog{ public $name="dog"; public

Concatenating Files And Insert New Line In Between Files

喜欢而已 提交于 2019-11-27 10:18:47
I have multiple files which I want to concat with cat . Let's say File1.txt foo File2.txt bar File3.txt qux I want to concat so that the final file looks like: foo bar qux Instead of this with usual cat File*.txt > finalfile.txt foo bar qux What's the right way to do it? You can do: for f in *.txt; do (cat "${f}"; echo) >> finalfile.txt; done Make sure the file finalfile.txt does not exist before you run the above command. If you are allowed to use awk you can do: awk 'FNR==1{print ""}1' *.txt > finalfile.txt If you have few enough files that you can list each one, then you can use process

Concatenate multiple files but include filename as section headers

六月ゝ 毕业季﹏ 提交于 2019-11-27 08:56:05
问题 I would like to concatenate a number of text files into one large file in terminal. I know I can do this using the cat command. However, I would like the filename of each file to precede the "data dump" for that file. Anyone know how to do this? what I currently have: file1.txt = bluemoongoodbeer file2.txt = awesomepossum file3.txt = hownowbrowncow cat file1.txt file2.txt file3.txt desired output: file1 bluemoongoodbeer file2 awesomepossum file3 hownowbrowncow 回答1: Was looking for the same