8℃
最近在CU上总是看到有人问date的一些用法,这里就针对一些非常规的或者说比较特殊的用法做个小结(当然,一些基本的用法就不做介绍了,不懂的请直接man吧),Feel free to give your comments...
以下讨论的内容主要涉及到3个方面:
1. 数字域的填充用法
2. 相对日期的获得
3. 时间戳和日期的互相转换
1. 数字域的填充:
默认情况下,在显示日期和时间时,date命令使用数字0填充数字域。例如,如果用两位数字显示月份,则6月显示为“06”,如下所示:
$ date +%m
06
当然,一切皆有变通,你可以用下述控制符...
Command, Date, Linux, Programme阅读全文
1℃
----------------------
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.
--...
Command, Linux, mv, Programme, Rename阅读全文
6℃
----------------------
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 ...
Command, Linux, Perl, Programme, Unix阅读全文
0℃
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...
Command, Sed阅读全文
2℃
本文已更新至: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...
Awk, Base, Binary, Command, Decimal, Hex, Linux, Programme阅读全文
4℃
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...
Command, Programme阅读全文
0℃
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...
Command, Programme阅读全文












谢谢分享
赶紧学习一下,谢谢!
谢谢 希望能下
好東西! 下來試一下。
谢谢你,我的问题已经解决了,
评论啊,你太伟大了
感谢分享,不知道现在还能下载
谢谢博主分享!