bash脚本来处理文本 [英] bash script to manipulate text

查看:161
本文介绍了bash脚本来处理文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好了,所以我有以下信息My.txt文件的文本文件

okay so i have a text file with the following info my.txt

user:pass
user:pass
user:pass
user:pass

我要打开的文件抓取的内容和操作的每一行,然后将它输出到一个文本名为MY2文件,所以它看起来像这样

i want to open the file grab the contents and manipulate each line then output it into a text called my2 file so it looks like this

http://mysever.com/2/tasks.php?account=user%3Apass
http://mysever.com/2/tasks.php?account=user%3Apass
http://mysever.com/2/tasks.php?account=user%3Apass
http://mysever.com/2/tasks.php?account=user%3Apass

谁能帮助

推荐答案

使用一个小awk脚本:

Use a little awk script:

 awk -F: '{printf "http://mysever.com/2/tasks.php?account=%s%%3A%s\n", $1, $2}' < my.txt > my2

这篇关于bash脚本来处理文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆