【LeetCode】shell
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的更多相关文章
- 【LeetCode】Minimum Depth of Binary Tree 二叉树的最小深度 java
[LeetCode]Minimum Depth of Binary Tree Given a binary tree, find its minimum depth. The minimum dept ...
- 【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 ...
- 53. Maximum Subarray【leetcode】
53. Maximum Subarray[leetcode] Find the contiguous subarray within an array (containing at least one ...
- 27. Remove Element【leetcode】
27. Remove Element[leetcode] Given an array and a value, remove all instances of that value in place ...
- 【刷题】【LeetCode】007-整数反转-easy
[刷题][LeetCode]总 用动画的形式呈现解LeetCode题目的思路 参考链接-空 007-整数反转 方法: 弹出和推入数字 & 溢出前进行检查 思路: 我们可以一次构建反转整数的一位 ...
- 【刷题】【LeetCode】000-十大经典排序算法
[刷题][LeetCode]总 用动画的形式呈现解LeetCode题目的思路 参考链接 000-十大经典排序算法
- 【leetcode】893. Groups of Special-Equivalent Strings
Algorithm [leetcode]893. Groups of Special-Equivalent Strings https://leetcode.com/problems/groups-o ...
- 【leetcode】657. Robot Return to Origin
Algorithm [leetcode]657. Robot Return to Origin https://leetcode.com/problems/robot-return-to-origin ...
- 【leetcode】557. Reverse Words in a String III
Algorithm [leetcode]557. Reverse Words in a String III https://leetcode.com/problems/reverse-words-i ...
随机推荐
- php输出日志的实现
php输出日志的实现 思想:在想要输出log日志的地方,使用php的写入文件函数,把数据写入到事先定义好的文件中. php代码如下: //输出日志 public function outputLog( ...
- 分享一个彻底冻结对象的函数——来自阮一峰老师的《ECMAScript 6 入门》
var constantize = (obj) => { Object.freeze(obj); Object.keys(obj).forEach( (key, i) => { if ( ...
- [译]Quartz.Net 框架 教程(中文版)2.2.x 之第三课 更多关于Jobs和JobDetails
第三课 更多关于Jobs和JobDetails 在这二课我们已经学习到,Jobs接口非常容易实现,只有一个execute方法.我们需要再学习一些知识去理解jobs的本质,Job接口的execute方法 ...
- Web应用程序完全测试指南
随着Web技术和移动互联网的发展,越来越多的应用被迁移到了云端,这也使得用户可以随时随地使用它们.目前大量的优质应用,逐渐提升了用户的品味,也降低了用户的容忍度,如果你的Web应用无法使用户满意,那么 ...
- 20155117王震宇 2006-2007-2 《Java程序设计》第一周学习总结
20155117王震宇 2006-2007-2 <Java程序设计>第一周学习总结 教材学习内容总结 尽量简单的总结一下本周学习内容 尽量不要抄书,浪费时间 看懂就过,看不懂,学习有心得的 ...
- Vue的keep-alive
Vue的keep-alive: 简答的做下理解 缓存!页面从某一个页面跳转到另一个页面的时候,需要进行一定的缓存,然后这个时候调用的钩子函数是actived,而在第一次加载的时候,created.ac ...
- Sublime快捷键(一)
最近在工作中,遇到的sublime的快捷键,以后再工作中用到的我会稍后增加的~ 快捷键: 1.切换标签页: Ctrl + Tab 切换标签页: Ctrl + Shift + Tab 返回刚切 ...
- TypeScript在react项目中的实践
前段时间有写过一个TypeScript在node项目中的实践. 在里边有解释了为什么要使用TS,以及在Node中的一个项目结构是怎样的. 但是那仅仅是一个纯接口项目,碰巧赶上近期的另一个项目重构也由我 ...
- UTF8字符串转换为汉字 c#
using System; /// <summary> /// UTF8字符串转换为汉字用的类 /// 转换如"\\u8d35"之类的字符串为对应的汉字 /// < ...
- 常见的bug
常见bug 一. Android系统功能测试设计的测试用例: a.对所测APP划分模块 b.详细列出每个模块的功能点(使用Xmind绘制功能图) c.使用等价类划分.边界值.场景法等对各功能点编写测试 ...