-1

I'm trying to sort and edit a long .txt file and I would like to delete all instances of the following from any line containing it.

[getpwnam_ext]
NSTIMI
  • 23
  • 3
  • This question has been answered here: http://stackoverflow.com/questions/5410757/sed-delete-a-line-containing-a-specific-string – Lettie Ozuna Jul 30 '14 at 21:20
  • at least, show what you try/search before asking a solution. Stackoverflow is not a code generator but a way to help to solve a problem about code or concept of code. – NeronLeVelu Jul 31 '14 at 05:51

1 Answers1

2

to remove just the text you mentioned, use:

sed -i 's/\[getpwnam_ext\]//g' filename

to remove the whole line that contains that text, use:

sed -i '/\[getpwnam_ext\]/d' filename
nullrevolution
  • 3,937
  • 1
  • 18
  • 20
  • 1
    I get this error sed: 1: "auth_2014uniq.txt": command a expects \ followed by text Also, [getpwnam_ext] is part of a word, I guess, which is od[getpwnam_ext], so I'm not sure if that makes a difference – NSTIMI Jul 30 '14 at 21:43