regex - How can I use perl/awk/sed to search for all occurrences of text wrapped in quotes within a file and then delete them? -
how can utilize perl, awk, or sed search occurrences of text wrapped in quotes within file, , print result of deleting occurrences file? not want alter file, print result of altering file sed does.
for example, file contains next :
data|more data|"not important"|"more unimportant stuff" i need print out:
data|more data|| but want leave file intact. tried using sed not take regexs.
i have tried this:
sed -e 's/\<["]+[^"]*["]+\>//g' file.txt but nil , prints original file. thoughts?
you seem have few characters in sed command.
sed -e 's/"[^"]*"//g' file.txt input:
"quoted text here" not quoted there never more "hello world" foo bar data|more data|"not important"|"more unimportant stuff" output:
not quoted there never more foo bar data|more data|| regex perl shell sed ksh
No comments:
Post a Comment