AWK / SED。如何删除简单的文本文件括号 [英] AWK/SED. How to remove parentheses in simple text file

查看:826
本文介绍了AWK / SED。如何删除简单的文本文件括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本文件看起来像这样:

I have a text file looking like this:

(-9.1744438E-02,7.6282293E-02) (-9.1744438E-02,7.6282293E-02)  ... and so on.

我想通过删除所有括号和新线每对夫妇修改文件
因此,它是这样的:

I would like to modify the file by removing all the parenthesis and a new line for each couple so that it look like this:

-9.1744438E-02,7.6282293E-02
-9.1744438E-02,7.6282293E-02
...

有一个简单的方法来做到这一点?

A simple way to do that?

任何帮助是AP preciated,

Any help is appreciated,

弗雷德

推荐答案

我会使用 TR 这个工作:

cat in_file | tr -d '()' > out_file

随着 -d 切换它只是删除在给定的任何字符。

With the -d switch it just deletes any characters in the given set.

要通过两个添加新信息,你可以用管道TR 取值:

cat in_file | tr -d '(' | tr ')' '\n' > out_file

这篇关于AWK / SED。如何删除简单的文本文件括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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