shantanuo
shantanuo

Reputation: 32316

removing special character

How do I remove the greater than < sign from the beginning of the line ^

file.txt
> INSERT INTO
> INSERT INTO

Expected:
INSERT INTO
INSERT INTO

Upvotes: 1

Views: 2087

Answers (3)

shantanuo
shantanuo

Reputation: 32316

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

Upvotes: 0

ghostdog74
ghostdog74

Reputation: 342363

awk

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

sed

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

cut

cut -d" " -f2- file

or using the shell

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

Upvotes: 0

Dennis Williamson
Dennis Williamson

Reputation: 360055

Give this a try:

sed 's/^> //' inputfile

Upvotes: 1

Related Questions