195. Tenth Line

输出file.txt中的第十行

答案:

# Read from the file file.txt and output the tenth line to stdout.
#!/bin/bash
cat file.txt | sed -n '10p'

193. Valid Phone Numbers

找出file.txt中符合(xxx) xxx-xxxx or xxx-xxx-xxxx格式的电话号码

答案:

 cat file.txt | grep  '^(\([0-9]{3}\) )[0-9]{3}-[0-9]{4}$|^([0-9]{3}-){2}[0-9]{4}$'

【LeetCode】shell的更多相关文章

  1. 【LeetCode】Minimum Depth of Binary Tree 二叉树的最小深度 java

    [LeetCode]Minimum Depth of Binary Tree Given a binary tree, find its minimum depth. The minimum dept ...

  2. 【Leetcode】Pascal's Triangle II

    Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3 ...

  3. 53. Maximum Subarray【leetcode】

    53. Maximum Subarray[leetcode] Find the contiguous subarray within an array (containing at least one ...

  4. 27. Remove Element【leetcode】

    27. Remove Element[leetcode] Given an array and a value, remove all instances of that value in place ...

  5. 【刷题】【LeetCode】007-整数反转-easy

    [刷题][LeetCode]总 用动画的形式呈现解LeetCode题目的思路 参考链接-空 007-整数反转 方法: 弹出和推入数字 & 溢出前进行检查 思路: 我们可以一次构建反转整数的一位 ...

  6. 【刷题】【LeetCode】000-十大经典排序算法

    [刷题][LeetCode]总 用动画的形式呈现解LeetCode题目的思路 参考链接 000-十大经典排序算法

  7. 【leetcode】893. Groups of Special-Equivalent Strings

    Algorithm [leetcode]893. Groups of Special-Equivalent Strings https://leetcode.com/problems/groups-o ...

  8. 【leetcode】657. Robot Return to Origin

    Algorithm [leetcode]657. Robot Return to Origin https://leetcode.com/problems/robot-return-to-origin ...

  9. 【leetcode】557. Reverse Words in a String III

    Algorithm [leetcode]557. Reverse Words in a String III https://leetcode.com/problems/reverse-words-i ...

随机推荐

  1. 【BZOJ】3495: PA2010 Riddle 2-SAT算法

    [题意]有n个城镇被分成了k个郡,有m条连接城镇的无向边.要求给每个郡选择一个城镇作为首都,满足每条边至少有一个端点是首都.n,m,k<=10^6. [算法]2-SAT,前后缀优化建图 [题解] ...

  2. Linux内核线程kernel thread详解--Linux进程的管理与调度(十)【转】

    转自:http://blog.csdn.net/gatieme/article/details/51589205 日期 内核版本 架构 作者 GitHub CSDN 2016-06-02 Linux- ...

  3. Machine Learning系列--隐马尔可夫模型的三大问题及求解方法

    本文主要介绍隐马尔可夫模型以及该模型中的三大问题的解决方法. 隐马尔可夫模型的是处理序列问题的统计学模型,描述的过程为:由隐马尔科夫链随机生成不可观测的状态随机序列,然后各个状态分别生成一个观测,从而 ...

  4. pyQt: eg3

    import sys import urllib2 from PyQt4 import QtCore from PyQt4 import QtGui class Form(QtGui.QDialog) ...

  5. RSA加密登录

    1.首先下载前端JS加密框架:jsencrypt 2.后台添加解密帮助类:RSACrypto(参考文章最后) 3.在登录页面先引入jquery.min.js,在引入jsencrypt.min.js 4 ...

  6. Java-悲观锁和乐观锁

    Java中的乐观锁与悲观锁: 1. Java中典型的synchronized就是一种悲观锁,也就是独占锁,不过JDK1.6之后对synchronized已经做了许多优化,也不能说是完全的悲观锁了: 2 ...

  7. cenos6.5安装vsftp

    1.安装 yum install vsftpd 2.配置 vi /etc/vsftpd/vsftpd.conf 检查是否如下配置 anonymous_enable=NO #禁止匿名访问 chroot_ ...

  8. 使用 redis 减少 秒杀库存 超卖思路

    由于数据库查询的及插入的操作 耗费的实际时间要耗费比redis 要多, 导致 多人查询时库存有,但是实际插入数据库时却超卖 redis 会有效的减少相关的延时,对于并发量相对较少的 可以一用 publ ...

  9. 数据库连接池(c3p0与druid)

    1.数据库连接池概念 其实就是一个容器(集合),存放数据库连接的容器.当系统初始化好后,容器被创建,容器中会申请一些连接对象,当用户来访问数据库时,从容器中获取连接对象,用户访问完之后,会将连接对象归 ...

  10. Logistic回归与梯度上升算法

    原创作品出处 原始出处 .作者信息和本声明.否则将追究法律责任.http://sbp810050504.blog.51cto.com/2799422/1608064 Logistic回归与梯度上升算法 ...