這是我的輸入文件..Sed則工作在一個系統上,但不能在其他
[[email protected] scripts]# cat ip6hdr.txt | xargs -n4
6000 0000 005C 3320
2001 0000 0000 0000
0000 0000 0000 0100
2001 0000 0000 0000
0000 0000 0000 0200
我想要的文件的第一行的最後兩個數字變化,即20
到00
。
我想這個..
cat ip6hdr.txt | xargs -n4 | sed '1,1s/\([0-9]*\) \([0-9]*\) \([0-9]*\) \([0-9][0-9]\)\([0-9][0-9]\).*/\1 \2 \3 \400 /'
以前它在Ubuntu上工作的罰款,現在不工作在Fedora在bash腳本
我沒有理由爲什麼它在一個系統上,而不是其他一個..
[[email protected] scripts]# sed --version
GNU sed version 4.1.5
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.
如果可能的話建議我一些替代..
檢查您的sed版本,即'sed --version'。另外爲什麼複雜的表達式,爲什麼不'sed'1s /..$/ 00 /''?祝你好運。 – shellter
你的問題是什麼?什麼是sed版本? – thiton
@shellter感謝和+1這個簡單的.. –