awk 将hdfs://ns2/data/music/mgba2/hive/music_mgba2_migu/recsys/user_subscribe变为hdfs://ns2/data/music/mgba2/hive/music_mgba2_migu/recsys/user_subscribe%
时间: 2023-07-06 14:33:33 浏览: 118
您可以使用 awk 的子字符串替换功能来解决这个问题。下面是示例代码:
```
echo "hdfs://ns2/data/music/mgba2/hive/music_mgba2_migu/recsys/user_subscribe" | awk '{sub(/user_subscribe/, "user_subscribe%"); print}'
```
输出结果为:hdfs://ns2/data/music/mgba2/hive/music_mgba2_migu/recsys/user_subscribe%
这里使用了 awk 的 sub 函数,它将字符串中匹配到的第一个子字符串替换为指定的字符串。在这里,我们用 % 替换了 user_subscribe。最后通过 print 函数输出结果。
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)