现在位置 >首页 > Command
8℃
2011年06月14日 Programme ⁄ 被围观 2,693+
date非常规用法总结
最近在CU上总是看到有人问date的一些用法,这里就针对一些非常规的或者说比较特殊的用法做个小结(当然,一些基本的用法就不做介绍了,不懂的请直接man吧),Feel free to give your comments... 以下讨论的内容主要涉及到3个方面: 1. 数字域的填充用法 2. 相对日期的获得 3. 时间戳和日期的互相转换 1. 数字域的填充: 默认情况下,在显示日期和时间时,date命令使用数字0填充数字域。例如,如果用两位数字显示月份,则6月显示为“06”,如下所示: $ date +%m 06 当然,一切皆有变通,你可以用下述控制符...
阅读全文

1℃
2011年05月19日 Unix-Linux ⁄ 被围观 1,606+
---------------------- Reproduced statement: This post is reprinted/referred/quoted from the following link, good article: http://www.go2linux.org/rename-bulk-files-with-linux-console-command ------------------------------------------------------------------------- Important notes: All examples of this article are tested successfully in Ubuntu/Debian environment. And I have tested these examples also in RHEL/Non-Debian environment, but failed. So, pls note about this. --...
阅读全文
6℃
2011年04月11日 Unix-Linux ⁄ 被围观 1,837+
---------------------- Reproduced statement: All the commands bellow are from "All commands" site, it's an amazing site, welcome to visit it: http://www.commandlinefu.com/commands/browse 1. clear screen, keep prompt at eye-level (faster than clear(1), tput cl, etc.) c() printf "\33[2J" this leaves the cursor at the bottom of the terminal screen, where your eyes are. ctrl-l moves it to the top, forcing you to look up. anticipated question/argument: how is it faster than an ...
阅读全文
0℃
2011年04月11日 Programme ⁄ 被围观 1,039+
Here I list a example to show how to change the first letter of all the words from lower-case to upper-case by using sed: Example: xiabao@6P9SN2X /home/xiaopan$ cat urfile #!/bin/bash if [ $# == 0 ] then echo "usage: search.sh -f filename -t target -o output"; fi  xiabao@6P9SN2X /home/xiaopan$ sed 's/\b[^ ]*\b/\u&/g' urfile #!/Bin/bash If [ $# == 0 ] Then Echo "Usage: Search.sh -F Filename -T Target -O Output"; Fi But, as you can see, there's still a problem: the...
阅读全文
2℃
2011年04月09日 Programme ⁄ 被围观 1,669+
Scale convertion
本文已更新至:http://scmbob.org/number_system_conversions.html 最近由于项目的问题,经常需要用到进制转换,这里就进制转换来做一个小结。 1. First let's take “HexBinDecOct” as a e.g, which is using "bc" and "obase": [10]-tdlteman@hzling05:~ -> echo "obase=16; `seq 9 15`" | bc    9    A    B    C    D    E    F    [12]-tdlteman@hzling05:~ -> echo "obase=16; 30" | bc    1E   2. By using "printf": [22]-tdlteman@hzling05:~ -> printf "%X\n" 30    1E   3. Awk: [Bo...
阅读全文
4℃
2011年04月09日 Programme ⁄ 被围观 1,965+
Of cause, if you want to generate a xls file by using scripts, perl is always the preferred one, it seems that it's impossible to generate a xls file by using shell, because there're too many restrictions, but actually, it does, shell can do this, see, following e.g, you just need echo something which by html to a file ended by xls, for e.g: xxx.xls Bash语言: 临时自用代码 [30]-tdlteman@hzling12:/bts_gmps_hz/Build_Tools/eNB_codes/test.xp -> cat urfile   <font col...
阅读全文
0℃
2011年04月09日 Programme ⁄ 被围观 1,018+
ls -l !cp:$
Substitute a specific argument for a specific command. In the example below, !cp:2 searches for the previous command in history that starts with cp and takes the second argument of cp and substitutes it for the ls -l command as shown below. # cp ~/longname.txt /really/a/very/long/path/long-filename.txt # ls -l !cp:2 ls -l /really/a/very/long/path/long-filename.txt In the example below, !cp:$ searches for the previous command in history that starts with cp and takes the las...
阅读全文

×
腾讯微博