文本左右对齐排版--shell
2017-09-02 12:54
513 查看
文本左右对齐排版
有文本4.txt如下:
111111111111111111111 98912 张三222222222222222222 150020 李四四
333333333333333333333 360000 王五
444444444444444444 2332 赵六六
555555555555555555 222 田七
666666666666666666666 999999
简单的文本通过批处理排版
编写代码
#! /bin/bash file=./4.txt echo -e "\n左对齐\n" while read line do printf "%-30s %-10d %-10s\n" ${line} done < ${file} echo -e "\n右对齐\n" while read line do printf "%30s %10d %10s\n" ${line} done < ${file}
运行结果
参考文档
文件读取:http://www.cnblogs.com/iloveyoucc/archive/2012/07/10/2585529.htmlecho转义:http://www.runoob.com/linux/linux-shell-echo.html
printf 命令:http://www.runoob.com/linux/linux-shell-printf.html
相关文章推荐
- 文本左右对齐排版的批处理
- 用CSS控制文本左右对齐且首行缩进
- 【CSS】文本对齐(左右均对整齐)及断行
- 分享怎样用CSS控制文本左右对齐且首行缩进的方法
- 用CSS实现文本左右对齐且首行缩进的代码
- [LeetCode] Text Justification 文本左右对齐
- ul li排版 左右对齐
- android 开发:使得TextView文本左右两边都对齐--解决中英文对齐问题。
- 自定义TextView,实现多行文本左右整齐排版
- LeetCode--Text Justification 文本左右对齐
- Div + CSS里面的文在前面的文本居左,后面的文本居右想当于左右分段对齐
- 个人信息排版左右对齐的TextView
- css 文本图标对齐与定位二三事
- Shell处理文本字符串常用命令
- Table使控件对齐,HTML预文本控制空格、空行
- Text Justification 文本对齐 @LeetCode
- Text Justification,文本对齐
- shell文本处理
- KEIL和source insight混合编辑时,文本对齐的方式
- shell删除文本文件中的空格