易截截图软件、单文件、免安装、纯绿色、仅160KB

linux批量该文件名

A 加后缀
1.问题:同以目录下有海量以日期命名的文件,其中有的有后缀,有的以点结尾,如20020101.,20020102.,……,20020101.td,20020102.td……
要求: 把所有以点结尾的加上后缀.ts
我的方法:
#!/bin/bash
for files in `ls *.`
do
mv $files `echo “$filests” `
done
2. 同上
mv $files ${files}ts
3. 同上
mv $files `$files.ts|sed ’s/\.//’ `
4. file =>file.txt
mv $files $files.txt
5. *.04 => *04.txt
mv $files $(echo ${files}.txt|sed ’s/\.//1′)
或者
mv $files `echo ${files}.txt|sed ’s/\.//1′ `
B 改后缀(.old => .new)
1. rename
rename .old .new *
2.
mv $files ${file%.old}.new
3.
mv $files `echo $files|tr .old .new`
4.
mv $files `echo $files|sed ’s/\.old/\.new/’ `
C 去后缀 (*.dat => *)
1. mv $files `echo $files |sed ’s/\.dat//’ `
2. mv $files `echo $files|tr .dat (4空格)`
D 改前缀 (re* => un*)
1. mv $files un${$files#re}
2. mv $files `echo $files | tr re un`
mv yourfile `date  "+%Y-%m-%d~%H-%M-%S"`
mv oldfile `date +%Y-%m-%d`
mv oldfile `date -I`
注意 第二个是大写的i 不是小写的L


相关文档:

linux下udp客户端源码示例

#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <s ......

linux下IP v6 tcp客户端源码示例

/***********************************
*
*client.c
*
**********************************/

#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sy ......

linux下共享内存(shm)使用示例

#include <sys/ipc.h>
#include <stdio.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#define PERM IPC_CREAT //S_IRUSR|S_IWUSR
#include <errno.h>
int main(int argc,char **argv)
{
int shmid[2048];
c ......

Linux设备驱动编程之阻塞与非阻塞

阻塞操作是指,在执行设备操作时,若不能获得资源,则进程挂起直到满足可操作的条件再进行操作。非阻塞操作的进程在不能进行设备操作时,并不挂起。被挂起的进程进入sleep状态,被从调度器的运行队列移走,直到等待的条件被满足。
  在Linux
  关于上述例程,我们补充说一点,如果将驱动程序中的read函数改为:
stat ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号