删除特殊字符

时间:2011-01-17 10:39:56

标签: sed awk grep

如何删除大于<从行的开头标记^

file.txt
> INSERT INTO
> INSERT INTO

Expected:
INSERT INTO
INSERT INTO

3 个答案:

答案 0 :(得分:1)

尝试一下:

sed 's/^> //' inputfile

答案 1 :(得分:0)

AWK

awk '{gsub(/^[ \t]*>[ \t]*/,"")}1' file
awk '{$1=""}1' file

SED

sed 's/^[ \t]*>[ \t]*//' file

cut -d" " -f2- file

或使用shell

while read -r line; do  echo ${line##>}; done < file

答案 2 :(得分:0)

awk -F'>' '{print $2}' file.txt