However to delete from a matter record, each strains that incorporate a circumstantial drawstring?

However to delete from a matter record, each strains that incorporate a circumstantial drawstring?

However would I usage sed to delete each traces successful a matter record that incorporate a circumstantial drawstring?


To distance the formation and mark the output to modular retired:

sed '/pattern to match/d' ./infile

To straight modify the record – does not activity with BSD sed:

sed -i '/pattern to match/d' ./infile

Aforesaid, however for BSD sed (Mac OS X and FreeBSD) – does not activity with GNU sed:

sed -i '' '/pattern to match/d' ./infile

To straight modify the record (and make a backup) – plant with BSD and GNU sed:

sed -i.bak '/pattern to match/d' ./infile

Location are galore another methods to delete traces with circumstantial drawstring too sed:

AWK

awk '!/pattern/' file > temp && mv temp file

Ruby (1.9+)

ruby -i.bak -ne 'print if not /test/' file

Perl

perl -ni.bak -e "print unless /pattern/" file

Ammunition (bash Three.2 and future)

while read -r linedo [[ ! $line =~ pattern ]] && echo "$line"done <file > omv o file

GNU grep

grep -v "pattern" file > temp && mv temp file

And of class sed (printing the inverse is sooner than existent deletion):

sed -n '/pattern/!p' file

Mistake producing weblog contented
Previous Post Next Post

Formulario de contacto