上一页 1 ··· 64 65 66 67 68
摘要: awk的next相当于循环中continue的作用,next后面的语句将不再执行。 例如,下面的例子中,包含数字3的那行的print语句没有被执行。 [root]$ seq 5 | awk '{print $0}' 1 2 3 4 5 [root]$ seq 5 | awk '/3/ {next} 阅读全文
posted @ 2016-02-25 16:18 seyjs 阅读(665) 评论(0) 推荐(0) 编辑
摘要: 例如:有一个文件test.txt,里面有这些数据。 meiguounix232 faguounix ribenunix zhongguounixtaobao hanguounixbaba 现在我想截取unix前面的数据,包含unix,并输出。 得到数据应该是: meiguounix faguouni 阅读全文
posted @ 2016-02-24 19:20 seyjs 阅读(1597) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Return true if 阅读全文
posted @ 2016-02-18 15:53 seyjs 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1.最简单的方法是使用tac [root ~]$ seq 5 |tac 5 4 3 2 1 2.使用tr和awk。 tr把换行符替换成自定义的分隔符,awk分解替换后的字符串,并逆序输出 [root ~]$ seq 5 | tr '\n' ' ' | awk '{for(i=NF;i>0;i--) 阅读全文
posted @ 2016-01-29 11:38 seyjs 阅读(994) 评论(0) 推荐(0) 编辑
摘要: chinaunix 上看到这么一题:echo 12345678.12|sed ****期望达到效果:12,345,678.12我的解法是先把字符串反转,然后根据‘.’分割,分割完成后对$2部分再进行一次字符串分割,并将结果保存在数组中,遍历数组,每循环三次输出一个‘,’[appadmin@acacb... 阅读全文
posted @ 2016-01-18 14:37 seyjs 阅读(549) 评论(0) 推荐(0) 编辑
摘要: Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assum... 阅读全文
posted @ 2016-01-15 14:31 seyjs 阅读(193) 评论(0) 推荐(0) 编辑
摘要: The Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are both foreign keys to the Users_Id at the Users tabl... 阅读全文
posted @ 2016-01-14 14:27 seyjs 阅读(360) 评论(2) 推荐(0) 编辑
摘要: The Employee table holds all employees. Every employee has an Id, and there is also a column for the department Id.+----+-------+--------+------------... 阅读全文
posted @ 2016-01-14 09:35 seyjs 阅读(197) 评论(0) 推荐(0) 编辑
上一页 1 ··· 64 65 66 67 68