English 中文(简体)
无法消除运输收益
原标题:Unable to remove carriage returns
  • 时间:2011-02-18 00:05:43
  •  标签:
  • sed

!!

我的任务是在我们从硬件供应商那里获得的档案中编写一份报告。 我需要为两个领域收集这些档案:测试仪和模型设计师;对于每个领域,我需要掌握相应的价值。

previous post上,我发现帮助编写基本报告,如:

    find . -name "*.VER" -exec egrep -A 1  Test_Version=|Model-Manufacturer:  {}  ;  

Model-Manufacturer:^M
R22-100^M
Test_Version=2.6.3^M
Model-Manufacturer:^M
R16-300^M
Test_Version=2.6.3^M

然而,产出数据与监督事务司的运输回报“^M”相混合。 My boss想要“Model-Manufacturer”显示“Version”即:

Model-Manufacturer:R22-100
Test_Version=2.6.3
Model-Manufacturer:R16-300
Test_Version=2.6.3

Using sed, I attempted to remove the "^M" characters for "Model-Manufacturer" but to no avail:

find . -name "*.VER" -exec egrep -A 1  Test_Version=|Model-Manufacturer:  {}  ;  | sed  s/Model-Manufacturer:^M//g 

这一指挥没有效力。 我在这里失踪了吗?

问题回答

引证:

sed  /Model-Manufacturer:/s/
//g 

如果你也有新路线,而且你希望把这两条线合为一,你就可以使用对你先前问题的答复中显示的一种技术。

您可使用<代码>dos2unix消除运输收益。 如果有的话。 或使用<条码>。

tr -d  
  < file

如果你把Bash重新用作你的伤口,或用自己写的文字的话,你应当能够做到:

sed -e s/<Ctrl-V><Ctrl-M>/g

移除捷克共和国。

Ctrl-V(主机上的主要中风)字面上插入下一个关键中风,Ctrl-M是运输回报。





相关问题
how to tell sed "dot match new line"

I can t figure how to tell sed dot match new line: echo -e "one two three" | sed s/one.*two/one/m I expect to get: one three instead I get original: one two three

sed: using search pattern in output

I d like to use the search pattern in the output part of a sed command. For instance, given the following sed command: sed /HOSTNAME=/cHOSTNAME=fred /etc/sysconfig/network I d like to replace the ...

Text manipulation and removal

I have text files generated by one of my tools with structure shown below. 1 line text (space) multiple lines text (space) multiple lines text nr 2 ----------------------------------------------------...

Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

how to use sed, awk, or gawk to print only what is matched?

I see lots of examples and man pages on how to do things like search-and-replace using sed, awk, or gawk. But in my case, I have a regular expression that I want to run against a text file to extract ...

Bulk Insert Code Before </body> Tag in 100 Files

I d like to insert <?php include_once( google_analytics.php ); ?> before the closing body tag of about 100 php files. Unfortunately the person who made the site didn t make a header or ...

Extract float from text line with sed?

I am issuing a sed replace on a line, trying to extract a particular floating-point value, but all that appears to be matched is the right-side of the decimal Text Line: 63.544: [GC 63.544: [DefNew: ...

热门标签